CerealBH Posted February 2, 2008 Share Posted February 2, 2008 the first preg_match works fine, but the 2nd gives me a unknown modifier, and i can't figure out why preg_match("<img border=\"0\" alt=\"\" src=\"(.*)\" />", $this->pageSource, $image); preg_match("<span class=\"redbtext\">(.*)</span>", $this->pageSource, $friends); Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/ Share on other sites More sharing options...
resago Posted February 2, 2008 Share Posted February 2, 2008 escape the / Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/#findComment-456214 Share on other sites More sharing options...
CerealBH Posted February 2, 2008 Author Share Posted February 2, 2008 / dosn't need to be escaped..... Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/#findComment-456216 Share on other sites More sharing options...
resago Posted February 2, 2008 Share Posted February 2, 2008 ??? not my problem then. Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/#findComment-456218 Share on other sites More sharing options...
CerealBH Posted February 2, 2008 Author Share Posted February 2, 2008 im not aware if its even possibel to escape -> / + it didn't need to be escaped in 1st preg_match which worked Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/#findComment-456222 Share on other sites More sharing options...
resago Posted February 2, 2008 Share Posted February 2, 2008 thats because you got lucky in that > has meaning! http://www.perl.com/doc/manual/html/pod/perlre.html Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/#findComment-456226 Share on other sites More sharing options...
CerealBH Posted February 2, 2008 Author Share Posted February 2, 2008 ... not exactly sure why u sent me to a perl refrence... Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/#findComment-456227 Share on other sites More sharing options...
resago Posted February 2, 2008 Share Posted February 2, 2008 preg = perl regex to escape / \/ Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/#findComment-456231 Share on other sites More sharing options...
CerealBH Posted February 2, 2008 Author Share Posted February 2, 2008 thanks that helped my understanding of whats going on alot more, but im getting Warning: preg_match() [function.preg-match]: Unknown modifier '(' in /home/recon/public_html/random/test.php on line 204 Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/#findComment-456237 Share on other sites More sharing options...
resago Posted February 2, 2008 Share Posted February 2, 2008 which line is that? Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/#findComment-456239 Share on other sites More sharing options...
CerealBH Posted February 2, 2008 Author Share Posted February 2, 2008 preg_match("<span class=\"redbtext\">(.*)</span>", $this->pageSource, $friends); the one i posted :/ i can't figure it out Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/#findComment-456244 Share on other sites More sharing options...
resago Posted February 2, 2008 Share Posted February 2, 2008 proper regex looks like this. '/<span class="redbtext">(.*)<\/span>/' Quote Link to comment https://forums.phpfreaks.com/topic/89073-solved-modifier-error-preg_match/#findComment-456387 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.