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

Fix alternations with empty sub-expressions with regex >= 0.2.7 #47

Merged
merged 1 commit into from
May 1, 2018

Conversation

robinst
Copy link
Contributor

@robinst robinst commented May 1, 2018

With regex 0.2.7 and higher, the trick to rewrite (a|b|) to (a|b|.{0}) doesn't work anymore, it fails with this error:

alternations cannot currently contain empty sub-expressions

So delegate it like this instead: ((?:a|b)?)

With regex 0.2.7 and higher, the trick to rewrite `(a|b|)` to
`(a|b|.{0})` doesn't work anymore, it fails with this error:

> alternations cannot currently contain empty sub-expressions

So delegate it like this instead: `((?:a|b)?)`
Copy link
Contributor

@raphlinus raphlinus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking that change!

@raphlinus raphlinus merged commit 2956e67 into google:master May 1, 2018
@robinst robinst deleted the fix-empty-alt-with-newer-regex branch May 1, 2018 02:45
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