Page MenuHomeFreeBSD

regex(3): Add test to cover recent BRE regression
ClosedPublic

Authored by kevans on Jul 13 2017, 4:24 AM.

Details

Summary

BREs recently became prematurely sensitive to the branching
operator, which outright broke expressions that used it instead of
failing silently. Test that \| is matching a literal | for the time
being.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kevans created this revision.Jul 13 2017, 4:24 AM
cem edited edge metadata.Jul 14 2017, 6:38 PM

Are \(\) not matching literal parentheses? I guess I'm confused why the 4th column is b|c (and why the first is b). (Also, I'm unfamiliar with this input format and just guessing at what things mean.)

In D11577#240230, @cem wrote:

Are \(\) not matching literal parentheses? I guess I'm confused why the 4th column is b|c (and why the first is b). (Also, I'm unfamiliar with this input format and just guessing at what things mean.)

Correct- In BRE's, \( and \) specify a matching group as () do in EREs.

The first column 'b' means "try this as a BRE only", the second column is the string to try matching it against, the third is the section of the string that the expression matches (all of it, in this case), and the fourth is a comma-separated list of what the subexpressions (matching groups) should match

cem accepted this revision.EditedJul 14 2017, 6:55 PM

Got it! Makes sense. (And consider it approved for commit, if Ed's still out.)

This revision is now accepted and ready to land.Jul 14 2017, 6:55 PM
ngie accepted this revision.Jul 20 2017, 7:08 PM
emaste accepted this revision.Jul 20 2017, 7:16 PM
This revision was automatically updated to reflect the committed changes.