Skip to content
Oniguruma regex library on the web using WebAssembly
JavaScript TypeScript C++ Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode encoding with single mapping table Jun 25, 2018
oniguruma @ dba7171 encoding with single mapping table Jun 25, 2018
scripts specify ENVIRONMENT shell to prevent node.js stuff Apr 19, 2019
spec create paging table from the index of the first muti-byte character Jun 25, 2018
src refactor to accomodate for breaking changes in emscripten 1.38.30 Apr 19, 2019
test Remove exception catcher to allow error bubbling Feb 21, 2018
.gitignore Init Feb 20, 2018
.gitmodules ignore changes in oniguruma submodule Jul 9, 2018
.npmignore unlist src/ from .npmignore for sourcemaps' sake May 21, 2018
LICENSE Init Feb 20, 2018
benchmark.js encoding with single mapping table Jun 25, 2018
package.json 2.2.2 Apr 19, 2019
tsconfig.json move towards browsers with async/await keyword support May 21, 2018
tslint.json Update tslint.json Nov 3, 2018

Onigasm (OnigurumaASM)

WebAssembly port of Oniguruma regex library.

Usage/API/Behaviour 1:1 with node-oniguruma port, tests are literally imported from node-oniguruma repository for maximum compliance.

Of course, unlike node-oniguruma, this library can't hook into roots of V8 and is therefore 2 times* slower than the former.

Instructions for porting your app to web


npm i onigasm

Light it up

WASM must be loaded before you use any other feature like OnigRegExp or OnigScanner

// index.js (entry point)

import { loadWASM } from 'onigasm'
import App from './App'

(async () => {
    await loadWASM('path/to/onigasm.wasm') // You can also pass ArrayBuffer of onigasm.wasm file

// `onigasm.wasm` file will be available at `onigasm/lib/onigasm.wasm` in `node_modules` of your project directory

Once loaded onigasm is a drop-in replacement for oniguruma

- import { OnigRegExp } from 'oniguruma'
+ import { OnigRegExp } from 'onigasm'

That's it!

* Tested under laboratory conditions using benchmark.js


onigasm is licensed under MIT License. See LICENSE in the root of this project for more info.


You can’t perform that action at this time.