Jump to content
UBot Underground

Recommended Posts

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.

Link to post
Share on other sites

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)
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...