dracoblue.net

preg_match multiple lines

If you try to use preg_match on strings, which do have multiple lines you run into the problems that they actually won't match at all.

This can be easily fixed by adding s-modifier, so:

/\[(code)\](.*?)\[\/code\]/

becomes to

/\[(code)\](.*?)\[\/code\]/s

and works like a charm!

In open source, php by @ 04 Jul 2008

comments powered by Disqus

Recent Files

Advertisement

Recent Dev-Articles

Read recently

About

Blogroll