RE2 for different platforms (Linux, Windows, macOS)
npm install wasm-re2`` bash`
npm i wasm-re2
` typescript
import { RE2 } from 'wasm-re2';
const regex = new RE2('(b|^a)', 'g');
const isFound = regex.test('aabc');
// true
const matches = regex.exec('aabc');
// [ ['a', 'a'], ['b', 'b'] ]
`
Executes a search for a match between a regular expression and a specified string.
Returns true or false.
Returns all matches of the regular expression against a string.
Works like non-iterable RegExp matchAll.
Exec returns all results in a 2D array where each result consists of [fullmatch, ...captureMathces].
Example:
`typescript
const regex = new RE2('(abc)\\d+(zxc)', 'g');
regex.exec('123abc123zxc123abc123zxc123')
// [ ['abc123zxc', 'abc', 'zxc'], ['abc123zxc', 'abc', 'zxc'] ]
`
Return a new string with some or all matches of a pattern replaced by a replacement.
Returns number of capture groups.
If you use mac proceed to Pull submodule google-re2.
You need node and python to be installed.
Install Debian from Microsoft Store, then launch and create UNIX user.
``
Enter new UNIX username:
New password:
Retype new password:
Then launch:
``
sudo apt-get update -y && sudo apt-get install nodejs npm git python -y
Install Subsystem WSL using Setting on Windows 10:
1. Open Settings.Apps
2. Click on .Related settings
3. Under the section, click the Programs and Features option.Turn Windows features on or off
4. Click the option on the left pane.Windows Subsystem
5. Check the for the Linux checkbox.OK
6. Click the button.
7. Then you need to reboot the PC.
Launch IDE with WSL, and do all next actions in WSL Terminal.
git submodule update --init
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
git pull
./emsdk install latest
./emsdk activate latest
from emsdk dir:
source ./emsdk_env.sh
from re2:
source ../emsdk/emsdk_env.sh
#### Install dependencies
npm i
#### Update/create foundation folder running
npm run foundation
##### Make sure you have permissions to execute the file chmod +x ./compile.sh
Run script npm run compile
#### Testing
npm test
#### If google-re2 module is updated
`bash`
git pull --recurse-submodules
#### Then run this script to update re2 package
`bash`
npm run build:update
To change rollup configuration read Rollup_FAQ.md in yaml-core` package or visit