Kovo Posted October 21, 2010 Share Posted October 21, 2010 Hello, Ive got the pattern below: preg_match_all('`\[(.+?)=?([a-zA-Z0-9_:\/=&\.]*?)\](.+?)\[/\1\]`', $string, $matches) Its part of a bbcode parser. My problem is the pattern in between the tags "(.+?)" does not match new lines so if I have a string like so: Hello \n World!The parser will break or skip it.How do I go about converting this pattern to accept new lines?Thank you! Link to comment Share on other sites More sharing options...
justsomeguy Posted October 21, 2010 Share Posted October 21, 2010 Use the multiline modifier or dotall modifier:http://www.php.net/manual/en/reference.pcr...n.modifiers.php Link to comment Share on other sites More sharing options...
Kovo Posted October 21, 2010 Author Share Posted October 21, 2010 Use the multiline modifier or dotall modifier:http://www.php.net/manual/en/reference.pcr...n.modifiers.php Where would I put it?preg_match_all('`\[(.+?)=?([a-zA-Z0-9_:\/=&\.]*?)\](.+?)\[/\1\]`s', $string, $matches) or preg_match_all('`\[(.+?)=?([a-zA-Z0-9_:\/=&\.]*?)\](.+?)\[/\1\]s`', $string, $matches) Thanks! Link to comment Share on other sites More sharing options...
justsomeguy Posted October 21, 2010 Share Posted October 21, 2010 The modifiers go after the ending delimiter.http://www.php.net/manual/en/regexp.reference.delimiters.php Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.