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

Find the right regex to extract the semantic version number #68

Open
amwebexpert opened this issue Jul 9, 2022 · 1 comment
Open

Find the right regex to extract the semantic version number #68

amwebexpert opened this issue Jul 9, 2022 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@amwebexpert
Copy link
Owner

I simplified the version extraction regex for now by quick and dirty fix: removing these lines 🤣 so the first semantic number detected is the one below... this could be improved later because I'm going to create the issue !

Originally posted by @amwebexpert in #67 (comment)

@amwebexpert amwebexpert added enhancement New feature or request good first issue Good for newcomers labels Jul 9, 2022
@lodenrogue
Copy link

You can probably go with something like this:

^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$

Found here: https://ihateregex.io/expr/semver/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants