MatchEditor(3I)
π MatchEditor(3I) π
okay bestie, welcome to the InterViews Reference Manual β¨ this one's about MatchEditor, a StringEditor with pattern matching, and honestly? it's giving β¨format policeβ¨ in the best way possible.
πΈ NAME πΈ
MatchEditor β a StringEditor with pattern matching π
β¨ SYNOPSIS β¨
#include <InterViews/matcheditor.h>
π¦ DESCRIPTION π¦
so MatchEditor is a StringEditor subclass (yes, it inherits, we love a nepo baby π) and what it does is check whether its contents are actually valid against a pattern you give it. vibe check for strings, fr fr π
when would you even use this? when you need the user to type something that has to be in a specific format β like a number, or a file name. you know, the stuff where chaos is not cute π
the matching pattern follows the rules of scanf(3). and because examples just hit different, here's some:
- pattern
"%3d"β matches a 3-digit integer π’ - pattern
"%[ab]"β matches a string that only contains a's and b's π °οΈπ ±οΈ - pattern
"(%f, %f)"β matches the string"(12.0, 5E23)"π
periodt. that's the whole concept.
π PUBLIC OPERATIONS π
MatchEditor(ButtonState*, const char* sample, const char* done)β makes a brand new MatchEditor object. theButtonState, thesamplestring, and the termination stringdoneall get passed straight on down to the StringEditor constructor. teamwork makes the dream work π«Άvoid Match(const char* pattern, boolean keystroke = true)β this is where you tell it what to match against. when MatchEditor does its matching thing, it will highlight any trailing part of the edit string that doesn't conform topattern, so the user can see exactly what's wrong and fix it. iconic, honestly π
and the keystroke situation: if keystroke is true, matching happens on every single keystroke (instant feedback, main character energy β¨). if it's false, matching only happens when the edit is completed (chill, lowkey, patient vibes πΈ).
some defaults for you: the initial pattern matches any string, and the initial value of keystroke is true π
π RESTRICTIONS π
okay so here's the fine print and we're gonna say it clearly because it matters:
MatchEditor usessscanfinternally to check the pattern match. and different versions ofsscanfhave different scanning capabilities β so the patterns you can actually use depend on your local version. go check with your local version to see what patterns you've got available. no cap, this is a real "your mileage may vary" moment π
π SEE ALSO π
- StringEditor(3I) β the parent, the blueprint, the origin story π
and that's a wrap, bestie!! this page came from the InterViews manual, dated 7 Dec 1989 β yes, 1989, ancient but still slaying, we love a vintage icon π π byeee π¦
π¦ where this page comes from
- debian bookworm: ivtools-dev 2.0.11d.a1-1+b4
- debian trixie: ivtools-dev 2.0.11d.a1-3+b4
- ubuntu jammy: ivtools-dev 2.0.11d.a1-1build1
- ubuntu noble: ivtools-dev 2.0.11d.a1-3build1
- ubuntu questing: ivtools-dev 2.0.11d.a1-3build7
- ubuntu resolute: ivtools-dev 2.0.11d.a1-3build9
- ubuntu stonking: ivtools-dev 2.1.1+git.2025.07.26.a1-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms