1.0.0 • Published 6 years ago
regexworld v1.0.0
with an array
const RegexWorld = require("./test.js");
RegexWorld
.setStr("this is a this test $$ahah$$ you know it a $$lol$$")
.setRegex([
RegexWorld.parse("this", "g"),
/\$\$(.*?)\$\$/gi
])
.regexStart(null, (err, result) => {
if(err) console.log(err);
console.log(result);
})
result:
[ [ [ 'this', index: 0 ], [ 'this', index: 10 ] ],
[ [ '$$ahah$$', 'ahah', index: 20 ],
[ '$$lol$$', 'lol', index: 43 ] ] ]
with an obj
const RegexWorld = require("./test.js");
RegexWorld
.setStr("this is a this test $$ahah$$ you know it a $$lol$$")
.setRegex({
"this": RegexWorld.parse("this", "g"),
"$$": /\$\$(.*?)\$\$/gi
})
.regexStart(null, (err, result) => {
if(err) console.log(err);
console.log(result);
})
result:
{ this: [ [ 'this', index: 0 ], [ 'this', index: 10 ] ],
'$$':
[ [ '$$ahah$$', 'ahah', index: 20 ],
[ '$$lol$$', 'lol', index: 43 ] ] }
with a simple regex
const RegexWorld = require("./test.js");
RegexWorld
.setStr("this is a this test $$ahah$$ you know it a $$lol$$")
.setRegex(/\$\$(.*?)\$\$/gi)
.regexStart(null, (err, result) => {
if(err) console.log(err);
console.log(result);
})
result:
[ [ '$$ahah$$', 'ahah', index: 20 ],
[ '$$lol$$', 'lol', index: 43 ] ]
1.0.0
6 years ago