Skip to content
This repository was archived by the owner on May 29, 2023. It is now read-only.

Fix anchoring of delegate regular expressions#21

Merged
raphlinus merged 1 commit intogoogle:masterfrom
robinst:fix-anchoring-of-delegates
Aug 11, 2017
Merged

Fix anchoring of delegate regular expressions#21
raphlinus merged 1 commit intogoogle:masterfrom
robinst:fix-anchoring-of-delegates

Conversation

@robinst
Copy link
Copy Markdown
Contributor

@robinst robinst commented Aug 3, 2017

Before, e.g. a lookahead like (?=x|a) would be wrong. The delegate RE
for the x|a part inside was compiled as ^x|a. This means only the
x was anchored, but not a.

Fix it by adding a non-capturing group so that the delegate is
^(?:x|a), which results in correct anchoring in this case (and
possibly others).

Before, e.g. a lookahead like `(?=x|a)` would be wrong. The delegate RE
for the `x|a` part inside was compiled as `^x|a`. This means only the
`x` was anchored, but not `a`.

Fix it by adding a non-capturing group so that the delegate is
`^(?:x|a)`, which results in correct anchoring in this case (and
possibly others).
@raphlinus raphlinus merged commit 26344b3 into google:master Aug 11, 2017
@raphlinus
Copy link
Copy Markdown
Contributor

Thanks for the fixes, appreciated!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants