Originally posted by Gargouil
i've tryed this:
preg_match("/[tag].*[\/tag]/", $string, $matches);
As Weedpacket said, use the s modifier.
Also... Using .* will give you problems if you have something like this:
[tag]foo[/tag] blah blah [tag]bar[/tag]
Using [tag].*[\/tag] will match this:
foo[/tag] blah blah [tag]bar
The reason being, the . is greedy and will match as much as it can. If you use .? instead, the ? makes it non-greedy. It will match as little as possible, meaning everything up to the first [/tag].