alexinchinatown 2 Posted September 28, 2016 Report Share Posted September 28, 2016 So I have this data:nr@id,alex@gmail.com,abc@abc.gif,scrappy@2x-5ca495c2.png,nr@wrapp,info@rexgc.com,2abc@abc.jpg,info@CarolineLabiner.com,104271145@N04,raster@2x.png,nr@wrapped Is there one regex code that can remove all the non-email from the data?These are the non-emails: nr@id, abc@agc.gif, scrappy@2x-5ca495c2.png, nr@wrapp,2abc@abc.jpg,104271145@N04,raster@2x.png,nr@wrapped Only alex@gmail.com,info@rexgc.com,info@carolinelabiner.com are actual emails I want to keep. Thanks in advance. Quote Link to post Share on other sites
Marani 80 Posted September 29, 2016 Report Share Posted September 29, 2016 I'm not good at regex but this worked in EditPad Lite for me: (\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[com]{3}\ http://uploads.im/j2cn5.pnghttp://uploads.im/j2cn5.png Quote Link to post Share on other sites
HelloInsomnia 1103 Posted September 29, 2016 Report Share Posted September 29, 2016 Try this regex: [a-zA-Z0-9\-_\.\+]+\@[a-zA-Z0-9\-]+(\.[a-zA-Z]{2,4}){1,2} As for the extensions you can then filter out the bad ones like image extensions and other file extensions that are 2 to 4 characters long which is probably most if not all of them. Alternatively, if you only want emails from a few different extensions like the main ones like .com .net .org .info .co.uk and so on you can add them into here using the same format just adding them on at the end (don't forget to escape the periods): [a-zA-Z0-9\-_\.\+]+\@[a-zA-Z0-9\-]+\.(com|net|co\.uk) Quote Link to post Share on other sites
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.