Skip to content

Commit

Permalink
Update differences.md on Regex Property Names
Browse files Browse the repository at this point in the history
  • Loading branch information
staltz authored Nov 8, 2023
1 parent a68e758 commit cfc4ed3
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion docs/api/differences.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
On Android, WASM *may* work.

0 comments on commit cfc4ed3

Please sign in to comment.