Hey I have a patteren which will match the [] (bbCode) style tags in a piece of text, but i cannot get it to match the tags if the span over mulitple lines
outputPHP Code:$string = <<<eof
sd as da [b][u][i][c]sample text[/c][/i][/u][/b] asd
fasdf
[c][small][b]Hello World[/b][/small][/c]
adhsdaof usdsdiof ;adsljfdf as [u]wow[/u]sdasd
sdfgsdfs[r]way
out[/r]
eof;
$pattern = '/\[.*?\].*?\[\/.*?\]/U';
$match_count = preg_match_all($pattern,$string,$array);
print_r($array);
Code:Array ( [0] => Array ( [0] => [b ][u ][i ][c ]sample text[/c ][/i ][/u ][/b ] [1] => [c ][small ][b ]Hello World[/b ][/small ][/c ] [2] => [u ]wow[/u ] ) )
If anyone can help me match code over multiple lines would be great.
Thanks![]()




Reply With Quote