Xero Posted October 1, 2009 Share Posted October 1, 2009 Hello.I'm using preg_match function here and I have one problem.If I have this input.. <Comments: This is anexample.> .. (my preg_match function is preg_match("@<Comments:(.*?)>@i", $line, $commentMatch) ), the match fails because the input is not in the same line. How can I make my preg_match to continue trough lines?I hope I was clear on my question. If you don't understand it, let me know Thanks. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 1, 2009 Share Posted October 1, 2009 There is a flag to indicate whether or not the pattern is multi-line. There's another flag to indicate if the dot operator should also match newlines, by default it does not.http://www.php.net/manual/en/reference.pcr...n.modifiers.php Link to comment Share on other sites More sharing options...
Xero Posted October 1, 2009 Author Share Posted October 1, 2009 Thanks a lot. That was exactly what I needed ^-^ Link to comment Share on other sites More sharing options...
jexus Posted October 5, 2009 Share Posted October 5, 2009 Why not just specify exactly what you want? preg_match('{<Comments:([^>]*)>}i', $line, $commentMatch); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.