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: wrong match found without capturing parens #13812
The overall match found should not depend on capturing parens. In this case, the
This happens in C++ RE2 as well.
Summarised from commentary elsewhere:
The problem is caused by factoring of common prefixes in alternations. Complex subexpressions (e.g. involving quantifiers) aren't safe to factor because that collapses their distinct paths through the automaton.
The fix that I've proposed for RE2 is very simple. I'll port it to Go with @rsc's blessing.