rupam_jaiswal Posted July 16, 2008 Share Posted July 16, 2008 Hi, I have to write a regular expression to fetch a email from the given type of string. Eg "Customer Service" <tina_data@rediffmail.com> so I have to extract email I,e tina_data@rediffmail.com But this can also be “<customer service>” <tina_data@rediffmail.com. So I have to find string like search first ‘<’ after second double quote(” “ ) Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/115014-fetch-email/ Share on other sites More sharing options...
JasonLewis Posted July 19, 2008 Share Posted July 19, 2008 Here, try this: $str = '"Customer Service" <tina_data@rediffmail.com>'; $str = preg_match("/[a-zA-Z_]+@[a-zA-Z]+\.[a-zA-Z]{2,4}/",$str,$matches); echo $matches[0]; Quote Link to comment https://forums.phpfreaks.com/topic/115014-fetch-email/#findComment-593962 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.