I have this code. I am trying to match on .mono-50, where 50 can be any number.
imageUrl = 'http://example.com/media/image.mono-50.png';
imageUrlSplit = imageUrl.split('/.mono-\d+/');
console.log(imageUrlSplit);
This does not match, but does match on my testing tool, regexr.com
I have done many variations on it including the following.
.split('/.mono\-\d+/');
.split('/\.mono\-\d+/');
.split('/.mono-\d+/g');
.split('/.mono\-\d+/g');
.split('/\.mono\-\d+/g');
All of these work in the tool, but none in Javascript. Am I misunderstanding something on how .split()
treats Regex?
I have seen this question, but it has not helped me solve this issue.