Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
regexp: CompilePOSIX does not appear to match leftmost-longest #9684
Run the following program:
I would expect it to print
choosing the longer of the two alternatives, as for example
FWIW, the "normalized", though equal form
Yes, the leftmost-longest only applies to the overall match. Within the match, it is the "first match" semantics of Perl. When POSIX mandated the submatch leftmost-longest rule they had no idea how to implement it without exponential time. It's not trivial and not worth it.
(It's possible but no one does except maybe Haskell.)