Regex library supporting POSIX semantic and lazy/non-greedy quantifiers

The 2024 edition of POSIX added a new feature for its Extended Regular Expressions (ERE) supporting “minimal repetition“; subsequently, I noted some problems with the wording of the published standard, and those are to be corrected.

A difference between POSIX, and PCRE (e.g. Perl, PHP, Python) semantics, is that POSIX uses matching “length” (longest/shortest match for greedy and non-greedy quantifiers), whereas PCRE uses repetition counts.

According to the original proposer, non-greedy repetition is a established feature in many regex implementations, and are ready to be adopted into the POSIX standard by the time they wrote the proposal, however, so far only 2 known implementations support it this (DragonflyBSD and macOS), and both their man page note interoperability issues, implementation bugs, and deviation from the standard; there is a library called TRE with a permissive license that support the POSIX semantic which the proposer believe implementations can adopt, but I personally believe there should be multiple independent implementations achieving interoperability before such feature can be introduced to the standard.

What library and programs are there out there, that supports POSIX ERE semantic of quantifiers? (based on string length rather than repetition counts)? I’d very much like to study the code in the wild, as I want to be more informed before contributing further to the standard.

Read more here: Source link