Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3439924

Browse files
author
Khanh Nguyen
committed
Updated README.md and package.json
1 parent 9ddc2bd commit 3439924

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

‎README.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Lucene to Regex for Javascript
2+
3+
This tiny project provides ability to convert a boolean query string to regular expressions.
4+
5+
### Installation
6+
```bash
7+
npm install --save lucene-to-regex
8+
```
9+
10+
### Usage
11+
12+
```js
13+
const ltr = require('lucene-to-regex')
14+
const regex = ltr.toRegex('Lucene AND Regex AND (easy NOT difficult)', 'i')
15+
16+
17+
regex.test('Lucene and regex are easy.')
18+
// result: true
19+
20+
regex.test('Lucene and regex are difficult.')
21+
// result: false
22+
```
23+
24+
25+
26+
### Changes
27+
The parser grammar is modified to support these prefix (+, -, #, @). The reason was to make it easy to build regex for twitter hashtags and mentions.
28+
29+
Check out [bripkens/lucene](https://github.com/bripkens/lucene) for lucene

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"build": "cat lucene.grammar | node_modules/pegjs/bin/pegjs > ./query_parser.js",
88
"test": "mocha"
99
},
10-
"author": "",
11-
"license": "ISC",
10+
"author": "NQKdev",
11+
"license": "MIT",
1212
"dependencies": {
1313
"lucene": "^1.1.3"
1414
},

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /