re2 1.22.0 → 1.22.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.
Files changed (3) hide show
  1. package/README.md +6 -3
  2. package/lib/new.cc +4 -0
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -351,16 +351,19 @@ console.log('re2_res : ' + re2_res); // prints: re2_res : abc,a,b,c
351
351
 
352
352
  `RE2` always works in the Unicode mode. See `RE2.unicodeWarningLevel` above for more details on how to control warnings about this feature.
353
353
 
354
- #### Unicode classes
354
+ #### Unicode classes `\p{...}` and `\P{...}`
355
355
 
356
356
  `RE2` supports a subset of Unicode classes as defined in [RE2 Syntax](https://github.com/google/re2/wiki/Syntax). Native Google RE2 supports only short names, e.g., `L` for `Letter`, `N` for `Number`, etc. Like `RegExp`, `RE2` supports both short and long names, e.g., `Letter` for `L`, by translating them to short names.
357
357
 
358
- The extended form `\p{name=value}` is not supported. Only form `\p{name}` is supported.
358
+ Generally, the extended form `\p{name=value}` is not supported. Only form `\p{name}` is supported.
359
+ The exception is `Script` and `sc` names, e.g., `\p{Script=Latin}` and `\p{sc=Cyrillic}`.
359
360
 
360
- The same applies to `\P{name}`.
361
+ The same applies to `\P{...}`.
361
362
 
362
363
  ## Release history
363
364
 
365
+ - 1.22.2 *Updated all dependencies and the list of pre-compiled targets: Node 20, 22, 24, 25 (thx, [Jiayu Liu](https://github.com/jimexist)).*
366
+ - 1.22.1 *Added support for translation of scripts as Unicode classes.*
364
367
  - 1.22.0 *Added support for translation of Unicode classes (thx, [John Livingston](https://github.com/JohnXLivingston)). Added [attestations](https://github.com/uhop/node-re2/attestations).*
365
368
  - 1.21.5 *Updated all dependencies and the list of pre-compiled targets. Fixed minor bugs. C++ style fix (thx, [Benjamin Brienen](https://github.com/BenjaminBrienen)). Added Windows 11 ARM build runner (thx, [Kagami Sascha Rosylight](https://github.com/saschanaz)).*
366
369
  - 1.21.4 *Fixed a regression reported by [caroline-matsec](https://github.com/caroline-matsec), thx! Added pre-compilation targets for Alpine Linux on ARM. Updated deps.*
package/lib/new.cc CHANGED
@@ -152,6 +152,10 @@ static bool translateRegExp(const char *data, size_t size, bool multiline, std::
152
152
  std::string name(data + i + 3, j - i - 3);
153
153
  if (unicodeClasses.find(name) != unicodeClasses.end()) {
154
154
  name = unicodeClasses[name];
155
+ } else if (name.size() > 7 && !strncmp(name.c_str(), "Script=", 7)) {
156
+ name = name.substr(7);
157
+ } else if (name.size() > 3 && !strncmp(name.c_str(), "sc=", 3)) {
158
+ name = name.substr(3);
155
159
  }
156
160
  if (name.size() == 1) {
157
161
  result += name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "re2",
3
- "version": "1.22.0",
3
+ "version": "1.22.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,13 +16,13 @@
16
16
  ],
17
17
  "dependencies": {
18
18
  "install-artifact-from-github": "^1.4.0",
19
- "nan": "^2.22.2",
20
- "node-gyp": "^11.2.0"
19
+ "nan": "^2.23.1",
20
+ "node-gyp": "^11.5.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@types/node": "^22.15.17",
23
+ "@types/node": "^24.10.0",
24
24
  "heya-unit": "^0.3.0",
25
- "typescript": "^5.8.3"
25
+ "typescript": "^5.9.3"
26
26
  },
27
27
  "scripts": {
28
28
  "test": "node tests/tests.js",