Example Code
// Positive Lookahead: A regex pattern matcher for the modern era
// Author: Regex Wizard, Lord of the Patterns
// Date: 2023-02-27 14:30:00
import { PosLookahead } from 'positive-lookahead';
// Match all words that contain the letter 'q'
const match = new PosLookahead('\\w+q\\w+').match('hello, world');
if (match.length > 0) {
console.log(match[0]);
}
// Match all words that start with 'foo'
const matchFoo = new PosLookahead('foo\\w+').match('foo bar, baz');
if (matchFoo.length > 0) {
console.log(matchFoo[0]);
}
// Match all words that end with 'z'
const matchEndsWithZ = new PosLookahead('\\w+z').match('quux');
if (matchEndsWithZ.length > 0) {
console.log(matchEndsWithZ[0]);
}
Matching Methods: The Dark Arts
Lookahead Optimizations: Because Performance Matters