You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lefteris
8b767d3c7f
|
4 years ago | |
---|---|---|
.. | ||
example | 4 years ago | |
test | 4 years ago | |
.travis.yml | 4 years ago | |
LICENSE | 4 years ago | |
index.js | 4 years ago | |
package.json | 4 years ago | |
readme.markdown | 4 years ago |
readme.markdown
quotemeta
escape regular expression metacharacters
This module is like
perl's quotemeta
without the part about \Q...\E
.
example
var quotemeta = require('quotemeta');
var query = new RegExp('\\d ' + quotemeta('node.js'));
var filter = function (x) { return query.test(x) };
var xs = [
'0 node^js y',
'1 node_js x',
'2 node.js 5',
'3 beep z',
'X node.js Y',
'4 boop w'
];
console.dir(xs.filter(filter));
methods
var quotemeta = require('quotemeta')
var escaped = quotemeta(string)
Return string
with metacharacters escaped with \
s.
install
With npm do:
npm install quotemeta
license
MIT