hi all,
i'm trying to figure this out:
<STYLE>
lots of text
and
linebreaks
</STYLE>
how can i detect ANYTHING that lies inside the style tag (incl. linebreaks)? i tried .*? but didn't help
thx
hi all,
i'm trying to figure this out:
<STYLE>
lots of text
and
linebreaks
</STYLE>
how can i detect ANYTHING that lies inside the style tag (incl. linebreaks)? i tried .*? but didn't help
thx
you probably need to add "s" modifier to the regexp. Without "s" dot doesn't match newlines.
remember however, that regexp is a wrong tool for parsing html, better consider a dedicated parsing library available in your language.
Regex is a bad way to parse HTML. Jeff Atwood has a nice article on it.
.*
doesn't work with your example text because .
does not match new lines. You can either enable single-line mode in your regex implementation (some don't support it, like javascript) or you can use [\S\s]*
in place of .*
.