I wrote a regex to fetch string from html, but it seems the multiline flag doesn't work.
this is my pattern and I want to get the text in h1 tag.
var pattern= /<div class="box-content-5">.*<h1>([^<]+?)<\/h1>/mi
m = html.search(pattern);
return m[1];
I created a string to test it. When the string contains "\n" the result is always null. If I remove all the "\n" , it gave me the right result, no matter with or without /m flag.
what's wrong with my regex?