tags:

views:

69

answers:

3

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

+2  A: 

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.

stereofrog
This is the correct answer
Jader Dias
+1  A: 

Regex is a bad way to parse HTML. Jeff Atwood has a nice article on it.

Mark Ursino
+2  A: 

.* 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 .*.

T. Stone
I found the alternative for `.*` very useful, thanks!
mark