I have few strings like follows,
Str1 = abc, email@example.com 123-456-7890
str2 = abc, firstname.lastname@example.org +61 123 321 222
str3 = abc - DEF email@example.com (404) 123-1111 ext. 4444
I want to get only numeric (Phone numbers) out of these strings. i.e : 123-456-7890 +61 123 321 222
(404) 123-1111 ext. 4444
Can anyone provided me regular expression for the same or any other way to do this.
Hi… Try this…
(str1.Split("@“c).ElementAt(1).ToString.Trim).Remove(0, str1.Split(”@“c).ElementAt(1).ToString.Trim).Split(” "c).ElementAt(0).Length+1)
I am a noob at expressions but that works here when I was testing.
I can try to explain, but I am not native english speaker and I may embarrass trying.
If your input strings will always be in this format, the regex expression provided above (i.e. (?<=.com ).*) shall work just fine.
IF the position of the phone numbers can change in the input string, the above regex WON’T work.
In that case, you first need to figure out all possible phone-number patterns, For the ones mentioned above, here’s the regex (which does seem complex, but it’ll do the job):
Try this Regex match:
Integer.Parse(Regex.Replace(x, "[^\d]", ""))
Revert back if you don’t know how to use Regex in UiPath
Thanks !! It worked for me
I have following string:
String str= "COO OPP (404) 851-1331 ext. 1520 "
I want to get result as (404) 851-1331 ext. 1520 like this by using regular expression only.
Can anyone provide me exact regular expression for the same.
@Raguvarthan i really dont know how to use regex
my input is (1) i just want 1 out of it i used below but still am getting zero
If each string has " *.com ", why not using String.Split(“com”)(1) to get your target?
Instead of using regular expression, I would suggest to use split activity either on the basis of or keyword ext. that is a part of your string