[thelist] PHP REg Exp

Fred Jones fredthejonester at gmail.com
Tue Dec 18 08:28:13 CST 2007


I am stuck with a simple Reg Exp. I want to do this:

preg_replace('/(.*)__START_STYLE__([.,\n]*)__END_STYLE__(.*)/','<style>$2 
</style>',$body);

meaning to scan the multiline string $body, find __START_STYLE__, find 
__END_STYLE__ and store any and all characters between them in $2.

I can't get it to work. The metacharacter . matches anything BUT line 
feed, but the above expression does NOT match what I need, which is: any 
character, including any and all characters.

any ideas?

Thanks.



More information about the thelist mailing list