strago Posted February 24, 2010 Share Posted February 24, 2010 preg_match('/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/is',$pageContent,$results); checks for xxx@ domain.com. What do you change the code to for checking for xxx-xxx-xxx@ domain.com Link to comment https://forums.phpfreaks.com/topic/193184-tiny-little-preg_match-question/ Share on other sites More sharing options...
Garethp Posted February 24, 2010 Share Posted February 24, 2010 "~([\w+.-]+)@~" Just for everything before the @. Link to comment https://forums.phpfreaks.com/topic/193184-tiny-little-preg_match-question/#findComment-1017448 Share on other sites More sharing options...
strago Posted February 24, 2010 Author Share Posted February 24, 2010 And that just spits out an error. preg_match('/~([\w+.-]+)@~[\w+\.]*\w+[\w+\-\w+]*\.\w+)/is',$pageContent,$results); Warning: Invalid argument supplied for foreach() in /public_html/file.php on line 90 Warning: preg_match() [function.preg-match]: Compilation failed: unmatched parentheses at offset 39 in /public_html/file.php on line 79 While preg_match('/([\w+.-]+@[\w+\.]*\w+[\w+\-\w+]*\.\w+)/is',$pageContent,$results); does it. Link to comment https://forums.phpfreaks.com/topic/193184-tiny-little-preg_match-question/#findComment-1017566 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.