Skip to content

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
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

2 participants