IP address identification in UI Path

Hey Folks,
I am new to Ui path and trying to figure out mail parsing.
I have a requirement in which if I receive any IP address in the mail body, the bot would be able to identify the IP and later on sent/ forward the email.
I am able to achieve the forwarding of emails. But couldn’t figure out the way in which the bot will differentiate between IP’s like 1.1.1.1 or 123.34.52.12.

Would need your help in figuring out this.
What needs to be mentioned in the body condition to acheive this?

@Rushi_Muni If you’re familiar with regex you can use this :
System.Text.RegularExpressions.Regex.Matches(itemBody,“\b\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\b”).Count>0

Us this Inside the if Condition

Thanks… it has worked :slight_smile:

Can you tell me the syntax if I need to differentiate a URL ( starting with https or http)
and domain(www. something.com) using regex.

@Rushi_Muni Do you wan to Check if it Contains the domain or you want to Extract that Domain?

@supermanPunch Only check.

@Rushi_Muni Inside if use this :
System.Text.RegularExpressions.Regex.Matches(itemBody,“[1]+([a-zA-Z0-9-][a-z0-9]+)?(.([a-z]+([a-z0-9-][a-z0-9]+)?)+)*$”).Count>0


  1. a-zA-z. ↩︎

Not working for domain or URL. Bot is not able to differentiate indicating a “No Match”

1 Like

Could you provide a separate regex for
URL- eg:- https://www.xyz.com
domain:- www.xyz.com

@Rushi_Muni Can you try this :
System.Text.RegularExpressions.Regex.Matches(itemBody,“[a-zA-z.:/]+([a-zA-Z0-9-][a-z0-9]+)?(.([a-z]+([a-z0-9-][a-z0-9]+)?)+)*”).Count

Its working… thanks just a small change, kept Count>0

@Rushi_Muni Yes :sweat_smile:

@supermanPunch
For URL’s like https:// xyz.com
and domain- xyz.com ; www.xyz.com
The domain of provided regex isn’t able to classify properly- [1]+([a-zA-Z0-9-][a-z0-9]+)?(.([a-z]+([a-z0-9-][a-z0-9]+)?)+)*$").Count>0

Could you see this.


  1. a-zA-z. ↩︎

@Rushi_Muni You want to just Check if there is domain present in the Body of Email right?

@supermanPunch Yes

@Rushi_Muni This Should work :
System.Text.RegularExpressions.Regex.Matches(itemBody,“[a-zA-z.]+([a-zA-Z0-9-][a-z0-9]+)?(.([a-z]+([a-z0-9-][a-z0-9]+)?)+)*”).Count>0