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 Quote 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 @. Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.