olli460 Posted October 29, 2009 Share Posted October 29, 2009 Hello, Im trying to write a little script for my forums i need to get the reply from my forums. Im trying this $pattern = '/<span class="postbody">(.*?)</span>/gis'; preg_match($pattern, $post, $video); However inside the stuff its grabbing there is stuff code like </p> etc and it keeps trying to use that as a modifier so i get the following error: Warning: preg_match() [function.preg-match]: Unknown modifier 'p' in /home/roms43c/public_html/porn_grab.php on line 21 Does anyone know a way around this? Link to comment https://forums.phpfreaks.com/topic/179479-preg_match-unknown-modifyer/ Share on other sites More sharing options...
cags Posted October 29, 2009 Share Posted October 29, 2009 This should possibly have been in the Regex forum, but no matter. Because you used forward slash as the delimiters, you have to escape instances of it used in the string... $pattern = '/<span class="postbody">(.*?)<\/span>/gis'; ... the more common alternative though is to use different delimiters when working with HTML/paths. $pattern = '~<span class="postbody">(.*?)</span>~gis'; Link to comment https://forums.phpfreaks.com/topic/179479-preg_match-unknown-modifyer/#findComment-946966 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.