You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .verb.md
+32-30
Original file line number
Diff line number
Diff line change
@@ -46,13 +46,14 @@ If you're interested in learning more about [character classes](http://www.regul
46
46
47
47
### Heavily tested
48
48
49
-
As of {%= date() %}, this library runs [2,783,483 test assertions](./test/test.js) against generated regex-ranges to provide brute-force verification that results are indeed correct.
49
+
As of {%= date() %}, this library runs [>1m test assertions](./test/test.js) against generated regex-ranges to provide brute-force verification that results are correct.
50
50
51
-
Tests run in ~580ms on my MacBook Pro, 2.5 GHz Intel Core i7.
51
+
Tests run in ~280ms on my MacBook Pro, 2.5 GHz Intel Core i7.
52
52
53
-
### Highly optimized
53
+
### Optimized
54
+
55
+
Generated regular expressions are optimized:
54
56
55
-
Generated regular expressions are highly optimized:
56
57
- duplicate sequences and character classes are reduced using quantifiers
57
58
- smart enough to use `?` conditionals when number(s) or range(s) can be positive or negative
58
59
- uses fragment caching to avoid processing the same exact string more than once
@@ -75,11 +76,11 @@ The main export is a function that takes two integers: the `min` value and `max`
This option only applies to **negative zero-padded ranges**. By default, when a negative zero-padded range is defined, the number of leading zeros is relaxed using `-0*`.
126
+
This option relaxes matching for leading zeros when when ranges are zero-padded.
_Note that `-001` and `100` are both three digits long_.
145
-
146
-
In most zero-padding implementations, only a single leading zero is enough to indicate that zero-padding should be applied. Thus, the leading zeros would be "corrected" on the negative range in the example to `-01`, instead of `-001`, to make total length of each string no greater than the length of the largest number in the range (in other words, `-001` is 4 digits, but `100` is only three digits).
147
-
148
-
If zeros were not relaxed by default, you might expect the resulting regex of the above pattern to match `-001` - given that it's defined that way in the arguments - _but it wouldn't_. It would, however, match `-01`. This gets even more ambiguous with large ranges, like `-01` to `1000000`.
149
-
150
-
Thus, we relax zeros by default to provide a more predictable experience for users.
151
-
152
-
</details>
153
-
154
152
## Examples
155
153
156
154
{%= examples() %}
@@ -179,6 +177,10 @@ This library does not support steps (increments). A pr to add support would be w
179
177
180
178
## History
181
179
180
+
### v5.0.0 - 2019-04-07
181
+
182
+
Optimizations. Updated code to use newer ES features.
0 commit comments