Jump to content
UBot Underground

Trying To Capture The .com .net .us In An Email Address


Recommended Posts

Hi

 

Im trying to capture the .com .net .us in an email address.  My regex works fine but it when I come across emails that have a subdomain it picks up the domain part after the period of the sub domain.

 

Here is my regex

(?<=[-_.0-9a-zA-Z]+@[-0-9a-zA-Z]+)\.[0-9a-zA-Z]+

Here is my example:

set(#emails,"AccreditedOnlinePsychologyDegrees@smallnach.science
EducationOnline@smallnach.science
info@twitter.com
joe.schmoe@yahoo.com
goeorge@mail.yahoo.com
BellyBuster@now.netjewi.eu
news@news.punchingbagnews.com
Vydox@low.fluentr.eu
big-john@yo.com
Best-Carb-Preventer@ray235.growartistdiet.us","Global")
set(#tld,$find regular expression(#emails,"(?<=[-_.0-9a-zA-Z]+@[-0-9a-zA-Z]+)\\.[0-9a-zA-Z]+"),"Global")

Link to post
Share on other sites

in first find regex node

 

use

@.*

 

that gets @blah.blah.com

 

then use replace regex node

use

@.*\..*\.|@.*\.

and replace with $nothing

 

leaves you with

net

com

etc

 

you want to do it htis way in case you have 2-5 letter root like "yo"

 

in the replace node you can "stack" the $find regex in the $replace regex orifinal text field.

 

 

sorry dont have ubot installed at the moment

hope that makes sense

 

CD

 

***** I edited replace regex

Link to post
Share on other sites

in first find regex node

 

use

@.*

 

that gets @blah.blah.com

 

then use replace regex node

use

@.*\..*\.

and replace with $nothing

 

leaves you with

net

com

etc

 

you want to do it htis way in case you have 2-5 letter root like "yo"

 

in the replace node you can "stack" the $find regex in the $replace regex orifinal text field.

 

 

sorry dont have ubot installed at the moment

hope that makes sense

 

CD

 

 

Yes CD it makes sense.  Its just that when I stop using ubot for a while and come back I forget everything lol.  It worked perfect..  Thanks :)

  • Like 1
Link to post
Share on other sites

here you go

 

set(#emails"AccreditedOnlinePsychologyDegrees@smallnach.science
EducationOnline@smallnach.science
info@twitter.com
joe.schmoe@yahoo.com
goeorge@mail.yahoo.com
BellyBuster@now.netjewi.eu
news@news.punchingbagnews.com
Vydox@low.fluentr.eu
big-john@yo.com
Best-Carb-Preventer@ray235.growartistdiet.us
me@mmeme.yo.com""Global")
set(#find$find regular expression(#emails"@.*"), "Global")
alert(#find)
set(#replace$replace regular expression(#find"@.*\\..*\\.|@.*\\."$nothing), "Global")
alert(#replace)
alert($replace regular expression($find regular expression(#emails"@.*"), "@.*\\..*\\.|@.*\\."$nothing))

 

CD

Link to post
Share on other sites

wuh? stray from ubot?

 

how dare you!!

 

just kidding

 

ya, I have been mostly in Python myself

 

glad it helped

 

CD

 

 

Programming is not something I do all the time.  Im mostly a graphic designer/ printer :)

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...