regexmap
Map multiple regular expressions to one or more strings
Installation
$ npm install regexmap
Example
const regexmap = ; let regexObject = "name": /alexa/ "age": /\d{2}/ ; let stringToMatch = "My name is alexa and I am 18."; ;
Output
name: 'alexa' index: 11 input: 'My name is alexa and I am 18.' age: '18' index: 26 input: 'My name is alexa and I am 18.'
Matching an array of strings to multiple regexps
let stringsToMatch = "My name is alexa and I am 18." "My name is tom and I am 25"; ;
Output
name: 'alexa' index: 11 input: 'My name is alexa and I am 18.' null age: '18' index: 26 input: 'My name is alexa and I am 18.' '25' index: 24 input: 'My name is tom and I am 25'
Tests
To run the test suite, first install the dependencies, then run npm test
:
$ npm install$ npm test