Open cspiel opened 6 years ago
To be honest, I no longer have any clue how/why we ended up with our own custom regex engine in omake (or more precisely, libmojave). Perhaps there were no good alternatives back in the day. But it seems wrong or at least completely unnecessary today - I would recommend replacing it with a more standard library.
When trying to capture a text enclosed in (non-nested) square brackets like, for example, in
with a longest, leftmost regular-expresison engine, I come up with
relying on Section 9.3.5 #1 of the POSIX Standard, which states
Thus I was surprised that osh(1) barfs:
Replacing the opening or closing square brackets inside the bracket expressions with their octal or hexadecimal equivalents works ok. This means that just the corner case of literal square brackets is not covered. (I'm aware that Omake/Osh do not claim to be POSIX-compliant.)
Full demo program:
Simply say
osh match.osh
to reproduce the error.