Skip to content

Commit ea83041

Browse files
committed
Changes in readme
1 parent 07e5dcd commit ea83041

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,37 @@ There are five basic comparators:
1717
* Greater than or equal to ``>=A.B.C``
1818

1919
### Advanced comparators
20-
##### Wildcard ``*`` ``*.*`` ``*.*.*``
20+
21+
##### Wildcards ``*`` ``*.*`` ``*.*.*``
22+
Wildcard comparators can be satisfied by any version, even prerelease one.
23+
24+
Instead of ``*`` character can be used ``x`` or ``X``.
25+
2126
##### Wildcard ranges ``A.*.*`` ``A.B.*``
22-
##### Caret with ``^A.B.C`` ``^A.B`` ``^A``
27+
Wildcard ranges can be satisfied when only part of version is matching. In contrast to wildcards, wildcard ranges cannot be satisfied by prerelease versions.
28+
29+
* ``A.*.*`` is satisfied when majors are the same,
30+
* ``A.B.*`` is satisfied when majors and minors are the same.
31+
32+
The special character (``*``, ``x`` or ``X``) is optional.
33+
34+
###### Examples
35+
* ``1.2`` := ``>=1.2.0 <1.3.0``
36+
* ``5.*.*`` := ``>=5.0.0 <6.0.0``
37+
38+
##### Caret ranges ``^A.B.C``
39+
Matches to compatible versions.
40+
41+
###### Examples
42+
* ``^1.2.3`` := ``>=1.2.3 <2.0.0``
43+
* ``^0.1.2`` := ``>=0.1.2 <0.2.0``
44+
* ``^0.0.1`` := ``>=0.0.1 <0.0.2``
45+
2346
##### Tilde ranges ``~A.B.C`` ``~A.B`` ``~A``
47+
If patch version is specified tilde ranges matches to all greater or equal versions with the same minor version. Otherwise is equivalent of ``A.B.*`` when minor version is specified or ``A.*.*`` when not.
48+
2449
##### Hyphen ranges ``A.B.C - X.Y.Z``
50+
Hyphen range ``A.B.C - X.Y.Z`` equivalent of ``>=A.B.C <=X.Y.Z``.
2551

2652
### Prerelease versions
2753
Prerelease versions can satisfy comparators set only when have the same minor major and patch numbers as at least one of comparators.

semver.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ normalize_rules()
253253
| sed 's/ - /_-_/g' \
254254
| sed 's/\([~^<>=]\) /\1/g' \
255255
| sed 's/\([ _~^<>=]\)v/\1/g' \
256-
| sed 's/x/*/g' \
256+
| sed 's/x/*/gi' \
257257
| sed 's/^ //g' \
258258
| sed 's/ $//g'
259259
}

0 commit comments

Comments
 (0)