You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Flow has no regular expressions in the standard library.
Use case
challenges/flow-specific/catalog.json states each challenge's required and
forbidden syntax as Python regular expressions (116 distinct patterns:
classes, \s \w \d \b, groups, alternation, bounded repeats such as [\s\S]{0,120}, lazy quantifiers, MULTILINE and DOTALL). Porting the
checker from Python to Flow meant matching them without re.
POSIX regcomp is not a substitute: its ERE has no \s, \d or lazy
repeats, glibc and macOS disagree on the extensions, and it works on bytes,
so {0,120} counts bytes where Python counts characters.
Current workaround
scripts/tools/lib/regex.flow: a backtracking matcher over code points for
the Python subset above, with continuation frames on an explicit stack and a
fast path for single-character repeats. It agrees with CPython on 80,172
catalog checks over every tracked .flow file and on 43 recorded re.search cases (scripts/tools/challenge_check/regex_cases.json).
Backreferences and lookaround are rejected.
Request
A stdlib/regex.flow with compile, search, match, fullmatch and capture
groups. The tools copy could be the starting point if the API is acceptable.
Activity
stdlib: regular expressions with Python re semantics; tools use them (#…
stdlib: regular expressions with Python re semantics; tools use them (#…
stdlib: process, regex, os and bytebuf (#1083)