A module to parse lucene query string to regular expressions
npm install lucene-to-regexThis tiny project provides ability to convert a boolean query string to regular expressions.
bash
npm install --save lucene-to-regex
`$3
`js
const ltr = require('lucene-to-regex')
const regex = ltr.toRegex('Lucene AND Regex AND (easy NOT difficult)', 'i')
// regex: /^(?=.?\bLucene\b)(?=.?\bRegex\b)(?=.?(?=.?\beasy\b)(?!.?\bdifficult\b)).$/i
regex.test('Regex and Lucene are easy.')
// result: true
regex.test('Lucene and regex are difficult.')
// result: false
``> You can set flag by passing an additional parameter to the method.
> Check out bripkens/lucene for lucene