regex-trigram-js
This project ports some ideas Russ Cox shared on
how Google Code Search works — in
particular the RegexpQuery
and related functions —
from Go to JavaScript. Since JavaScript doesn't have an equivalent to Go's regexp/syntax
,
use PEG.js to introduce a simplified regular
expression grammar and obtain a parse tree.
The goal is to query trigram indexes from JS clients.
Usage
Include the library.
var regex = ;
Parse a regular expression.
var re = regex;console;
Which should look like:
Convert the parsed regular expression into a trigram query.
var q = regex;console;
Which should look like: