re2 1.19.1 → 1.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/package.json +3 -3
- package/re2.js +1 -0
- package/tests/test_matchAll.js +14 -0
package/README.md
CHANGED
|
@@ -54,11 +54,11 @@ Supported properties:
|
|
|
54
54
|
* [`re2.global`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global)
|
|
55
55
|
* [`re2.ignoreCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/ignoreCase)
|
|
56
56
|
* [`re2.multiline`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline)
|
|
57
|
-
*
|
|
57
|
+
* [`re2.dotAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/dotAll) — *since 1.17.6.*
|
|
58
58
|
* [`re2.unicode`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicode)
|
|
59
59
|
* `RE2` engine always works in the Unicode mode. See details below.
|
|
60
|
-
* [`re2.sticky`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky)
|
|
61
|
-
*
|
|
60
|
+
* [`re2.sticky`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky) — *since 1.7.0.*
|
|
61
|
+
* [`re2.hasIndices`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/hasIndices) — *since 1.19.0.*
|
|
62
62
|
* [`re2.source`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/source)
|
|
63
63
|
* [`re2.flags`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/flags)
|
|
64
64
|
|
|
@@ -71,7 +71,7 @@ Supported methods:
|
|
|
71
71
|
Starting with 1.6.0 following well-known symbol-based methods are supported (see [Symbols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol)):
|
|
72
72
|
|
|
73
73
|
* [`re2[Symbol.match](str)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/match)
|
|
74
|
-
*
|
|
74
|
+
* [`re2[Symbol.matchAll](str)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/matchAll) — *since 1.17.5.*
|
|
75
75
|
* [`re2[Symbol.search](str)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/search)
|
|
76
76
|
* [`re2[Symbol.replace](str, newSubStr|function)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/replace)
|
|
77
77
|
* [`re2[Symbol.split](str[, limit])`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/split)
|
|
@@ -353,6 +353,7 @@ console.log('re2_res : ' + re2_res); // prints: re2_res : abc,a,b,c
|
|
|
353
353
|
|
|
354
354
|
## Release history
|
|
355
355
|
|
|
356
|
+
- 1.19.2 *Bugfix: infinite loop in matchAll() with empty matches. Thx, [ziyunfei](https://github.com/ziyunfei).*
|
|
356
357
|
- 1.19.1 *Bugfix: indices for the `d` flag when `lastIndex` is non zero. Bugfix: the match result. Thx, [teebu](https://github.com/teebu).*
|
|
357
358
|
- 1.19.0 *Added `hasIndices` AKA the `d` flag. Thx, [teebu](https://github.com/teebu).*
|
|
358
359
|
- 1.18.3 *Fixed bug with non-matched groups. Thx, [Dan Setterquist](https://github.com/dset).*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "re2",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.2",
|
|
4
4
|
"description": "Bindings for RE2: fast, safe alternative to backtracking regular expression engines.",
|
|
5
5
|
"homepage": "https://github.com/uhop/node-re2",
|
|
6
6
|
"bugs": "https://github.com/uhop/node-re2/issues",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"node-gyp": "^9.4.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/node": "^20.
|
|
19
|
+
"@types/node": "^20.4.5",
|
|
20
20
|
"heya-unit": "^0.3.0",
|
|
21
|
-
"typescript": "^5.1.
|
|
21
|
+
"typescript": "^5.1.6"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"test": "node tests/tests.js",
|
package/re2.js
CHANGED
package/tests/test_matchAll.js
CHANGED
|
@@ -77,5 +77,19 @@ unit.add(module, [
|
|
|
77
77
|
eval(t.TEST('match[0] === expected[i]'));
|
|
78
78
|
++i;
|
|
79
79
|
}
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
function test_matchAll_empty_match(t) {
|
|
83
|
+
'use strict';
|
|
84
|
+
|
|
85
|
+
const str = 'foo';
|
|
86
|
+
// Matches empty strings, but should not cause an infinite loop
|
|
87
|
+
const re = new RE2('(?:)', 'g');
|
|
88
|
+
const result = Array.from(str.matchAll(re));
|
|
89
|
+
|
|
90
|
+
eval(t.TEST('result.length === str.length + 1'));
|
|
91
|
+
for (let i = 0; i < result.length; ++i) {
|
|
92
|
+
eval(t.TEST('result[i][0] === ""'));
|
|
93
|
+
}
|
|
80
94
|
}
|
|
81
95
|
]);
|