From cfc4ed3f7517ddc28a0366c58d5e6cb9a602547e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Staltz?= Date: Wed, 8 Nov 2023 14:55:43 +0200 Subject: [PATCH] Update differences.md on Regex Property Names --- docs/api/differences.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/api/differences.md b/docs/api/differences.md index b1e6f02..25ac1d3 100644 --- a/docs/api/differences.md +++ b/docs/api/differences.md @@ -119,6 +119,31 @@ Like `os.platform()`, this is the string `'android'` or `'ios'`, depending on th The `process.versions` object is supported, but also includes the `'mobile'` key, containing the version for the nodejs-mobile core library. +### RegExp Unicode Property Names + +:::danger +Unsupported +::: + +Nodejs-mobile is compiled with no internationalization which means that Unicode Property Names are not supported, examples: + +- `\p{Letter}` +- `\p{L}` +- `\p{ID_Start}` +- `\p{ID_Continue}` + +As an alternative, you can unwrap the characters belonging to property names, like this: + +```js +const regenerate = require('regenerate'); +const codePoints = require('@unicode/unicode-13.0.0/Binary_Property/ID_Start/code-points.js'); + +const set = regenerate(codePoints); +console.log(new RegExp(`[$_${set.toString()}]`)); +``` + +Or do such as a dedicated package, like [unicode-word-regex](https://github.com/staltz/unicode-word-regex) does. + ### WebAssembly :::danger @@ -127,4 +152,4 @@ Unsupported On iOS, WASM is unsupported because it requires Just-in-time (JIT) interpretation, which is forbidden by Apple's App Store guidelines. -On Android, WASM *may* work. \ No newline at end of file +On Android, WASM *may* work.