I’m trying to match a string in a HTML source code with starting <!--sliderStart--> and ending <!--sliderEnd-->
Example1:
<!--sliderStart-->
<p>blah</p>
<p>blah2</p>
<!--sliderEnd-->
Example2:
<!--sliderStart--><p>blah</p><p>blah2</p><!--sliderEnd-->
This is my pattern, but it’s not working efficiently:
$pattern = "/<!--sliderStart-->[^\n]+(.*?)<!--sliderEnd-->/";
What’s the exact pattern for this matching?
Regular expression dots don’t match newlines unless you tell them to. You need a
smodifier at the end of your regex, like so: