devWhiz Posted August 5, 2011 Share Posted August 5, 2011 I need to grab what is in between ('Row: 1, Field: 1')" and ('Row: 10, Field: 40') also, would it be possible for regex to remove certain emails from a list in this format pmssweet@yahoo.com, cuddles150@msn.com, xxmrsevilxx@msn.com, glentjackson2@yahoo.com, glentjackson2@ymail.com, glentjackson2@rocketmail.com, alexkilledkenny@yahoo.com, wvsilver2002@yahoo.com, raceinvader@yahoo.com, csexiboi001@aol.com, I want to remove all of the aol emails and msn emails and gmail emails and only leave yahoo.com, rocketmail.com and ymail.com, all other emails I want deleted Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted August 5, 2011 Share Posted August 5, 2011 1. what exactly do you need to grab between the parenthesis? 2. yes you can, using preg_match to weed out the invalid email adresses with a pattern like, however, re-reading your post makes me wonder exactly which emails you want to get rid of? Quote Link to comment Share on other sites More sharing options...
.josh Posted August 6, 2011 Share Posted August 6, 2011 $content = <<<EOF ('Row: 1, Field: 1')"stuff here('Row: 10, Field: 40') EOF; preg_match("~\('Row: 1, Field: 1'\)\"\K(??!\('Row: 10, Field: 40'\)).)*~",$content,$match); $emails = "pmssweet@yahoo.com, cuddles150@msn.com, xxmrsevilxx@msn.com, glentjackson2@yahoo.com, glentjackson2@ymail.com, glentjackson2@rocketmail.com, alexkilledkenny@yahoo.com, wvsilver2002@yahoo.com, raceinvader@yahoo.com, csexiboi001@aol.com, test@yahoo.com, blah@blah.com"; $emails = preg_replace('~(?:^|,)[^@]+@(??!(?:,|(yahoo|rocketmail|ymail)\.com)).)+~i','',$emails); Quote Link to comment 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.