Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for merging patterns #2

Merged
merged 1 commit into from
Apr 24, 2019

Conversation

qzb
Copy link

@qzb qzb commented Mar 25, 2019

Despite of what README states, regular expressions can be merged using zero-length assertions:
https://www.regular-expressions.info/lookaround.html

@mokkabonna mokkabonna merged commit a014ab3 into mokkabonna:master Apr 24, 2019
@mokkabonna
Copy link
Owner

Thanks!

@mokkabonna
Copy link
Owner

This turned out to not work as expected, see #44

For example this works as expected:

/(?=1)(?=\d)/.test('1') // true

This does not:

/(?=1)(?=2)/.test('12') // false

This however works as expected:

/(?=.*1)(?=.*2)/.test('12') // true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants