Comments (6)
And now with corrected tags:
^v?(?P<major>\d+)\.(?P<minor>\d+)\.?P<patchlevel>\d+)~?(?P<special>[a-z]\w+[\d+])?$
from semver.org.
So I guess Python doesn't use PCRE, does it?
Anyway, here the expressions from my Java implementation (not yet published):
protected static final Pattern special_pattern = Pattern.compile("[A-Za-z][0-9A-Za-z-]*"); protected static final Pattern semver_pattern = Pattern.compile("v?(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?([A-Za-z][0-9A-Za-z-]*)?");
This expression also accepts version numbers with the minor and/or patch number omitted, e.g. "1.2" or "1alpha".
from semver.org.
I think it does. What you get from my regex is a dictionairy (key/value pairs) where the keys are "major", "minor", "patchlevel", "special" so that you can access the different parts by name and not by index from the regex grouping.
from semver.org.
@serverhorror your regex doesn't adhere to rule 3 properly. Something like [a-zA-Z][-a-zA-Z0-9]*
is better for the body of the 'special' clause.
The rule doesn't explicitly declare it, but it seems odd to allow a trailing dash (-
). Perhaps this should be brought up as another issue. This can be included by changing the 'special' clause to ([a-zA-Z][-a-zA-Z0-9]*)(?<!-)
.
from semver.org.
I think this is outside the scope of SemVer. The spec should state the requirements clearly enough to easily construct a RegEx, and if it does not then that is a failure of the spec and should be addressed separately.
from semver.org.
I know this is old, but would it be beneficial to have "examples" enough to that implementation builders have test cases?
from semver.org.
Related Issues (20)
- Should we translate BNF? HOT 6
- Font issues on certain translations (namely CJK that have larger fonts)
- BG: "semantic versioning" needs to be translated differently HOT 3
- Canβt list all spec version when Vietnamese selected HOT 1
- Catalan translation HOT 6
- Create translation reviewers list HOT 1
- ##
- Specify en-US instead of en HOT 1
- SVG of icon?
- [zh-TW] Suggest that "Release" to be translated into "ηΌθ‘". HOT 1
- Turkish version HOT 1
- Initial words of documentation lines are incorrectly spread over 2 lines, half a line below rest of text block HOT 1
- I'm sorry, but as an AI language model, I'm not able to access the link you just sent me. If you need any help or assistance with something else, please let me know! HOT 1
- Interested to add Bengali translation. HOT 1
- Semver.org
- Typo in Czech translation HOT 1
- A small problem in PT-BR translation
- Bengali Translation HOT 1
- Proposal for an official JSON Schema for semver HOT 1
- No license in the repository HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from semver.org.