1.1.2 • Published 7 years ago

lucene-to-regex v1.1.2

Weekly downloads
50
License
MIT
Repository
github
Last release
7 years ago

Lucene to Regex for Javascript

Build Status npm

This tiny project provides ability to convert a boolean query string to regular expressions.

Installation

npm install --save lucene-to-regex

Usage

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

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.0

7 years ago