Answer the question
In order to leave comments, you need to log in
How to fix regular expression in JS?
regexr.com/3br05
product-spec is in the first line
product-minicard in the last line
And if you remove line breaks, everything works regexr.com/3br08
Why? I have the m modifier! Well, how to fix it?
Answer the question
In order to leave comments, you need to log in
You answered your own question - there are hyphens in the line. You need something like this: The m
modifier affects the work of ^ and $ (in other languages, the behavior may be different), read about it in the documentation.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question