I tested the following code with a regexp inside and the console log is printing null. Here's the code :
var decRegexp = new RegExp("[0-9]{2}-(\\n)*\s*[A-Z]{1,3}-(\\n)?\s*[0-9]{2,3}", "g");
var textToTest = "n° 14-\n DCC-71 du du 4 juin 2014"
var decisionNumberMatches = textToTest.match(decRegexp);
console.log(decisionNumberMatches);
Seriously, I don't understand why it's not returning me "n° 14-\n DCC-71 du du 4 juin 2014". I tested this regexp on http://jsregex.com/ and it works, so maybe it's a strange behaviour of nodejs.
Aucun commentaire:
Enregistrer un commentaire