pcremu
v0.0.4
Published
PCRE emulation for JavaScript
Downloads
1,446
Readme
PCREmu
PCRE emulation for JavaScript.
Usage
Example usage if consuming from outside an ES module:
$ npm i pcremu
const pcremu = require('pcremu').default;
// Create a matcher for your regex.
const matcher = pcremu.compile('^something');
// Match the regex against your input string.
const match = matcher.matchOne('something here');
console.log(match.getCaptureCount()); // Outputs "1".
console.log(match.getLength()); // Outputs "9" (the length of the word "something").