This line of regex is breaking in javascipt, however when using a regex tester it works correctly:
var pattern = new RegExp(/^(?m)^([A-Z0-9]{2,4})(?:\s*[A-Z0-9]{3})?$/);
"SL44BZ".match(pattern);
How do I make this work with javascript's .match()?
It should return an array of two results splitting at the 'SL4'.
It looks like this issue is with the multiline '(?m)' flag, however if I remove this wrong results are returned.