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

Improve the regex, require Node.js 8 #15

Merged
merged 3 commits into from
Apr 19, 2019

Conversation

stroncium
Copy link
Contributor

@stroncium stroncium commented Mar 24, 2019

  • Added invalid strings from This regex is broken by design #14

  • Made regexp respect Semantic Versioning 2.0.0 clause 9

  • Made regexp to only respect boundaries to whitespace and beginnings/ends of strings

  • Changed older tests to not violate clause 9
    '1.2.3-alpha.10.beta.0', '1.2.3-alpha.10.beta.0+build.unicorn.rainbow'
    became
    '1.2.3-alpha.10.beta', '1.2.3-alpha.10.beta+build.unicorn.rainbow'

  • Fixed v prefix is not part of semver #7 while I was at it.

  • [WIP] nodejs v6


Fixes #14
Fixes #7

@stroncium stroncium changed the title Fixes #14, fixes #7 [WIP] Fixes #14, fixes #7 Mar 24, 2019
@stroncium stroncium changed the title [WIP] Fixes #14, fixes #7 Fixes #14, fixes #7 Apr 17, 2019
@stroncium
Copy link
Contributor Author

@sindresorhus Both fixes aren't possible without lookbehind assertions, which aren't available in Node.js v6 without --harmony flag. I bumped min version to 8.

@sindresorhus sindresorhus changed the title Fixes #14, fixes #7 Improve the regex Apr 19, 2019
@sindresorhus sindresorhus changed the title Improve the regex Improve the regex, require Node.js 8 Apr 19, 2019
@sindresorhus sindresorhus merged commit 3fe447d into sindresorhus:master Apr 19, 2019
@sindresorhus
Copy link
Owner

Awesome! :)

@sindresorhus
Copy link
Owner

@stroncium This PR introduces catastrophic backtracking to the regex. Specifically this part (?=$|\s).

I have worked around it for now, but it would be great if you could try to bring back the old functionality: 6baf2cc

Playground: https://regex101.com/r/X20eYT/2

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.

This regex is broken by design v prefix is not part of semver
2 participants