Regex- Expression

Hi All,

In the below text I need to extract 9591234640 and SU89976

Hello
Shamsundar@gmail.com
9591234640
SU89976
Please find the above details of Shankar

for this I have written regex as:
\d{10}\ *(\n[A-Za-z]{2}(\d{5}))

but when I run this I am getting error.Can anyone guide me on this

@Sharanabasava_Kallur - can you share the error details?

Hi,
I am not getting error, but I am not getting any output.

try with

System.Text.RegularExpressions.Regex.Match(“YOUR TEXT”, “EXPRESSION”).Value.Trim

@Sharanabasava_Kallur
maybe you can split the match into the 2 parts:
\d{10}|[A-Za-z]{2}\d{5}

grafik
grafik

also use the watch panel / Debug mode to validate pattern and result e.g. with
Regex:Matches(InputString, Pattern)

@Sharanabasava_Kallur

Check as below attached

Regex.zip (16.4 KB)

Mark as solution if this helps

Thanks

Hi @Sharanabasava_Kallur,

Please find the regex pattern below.

.*(\d{10})\n(\w{2}\d{5}).*

It will give two groups after the match.

PhoneNo = RegexMatch(0).Groups(1).ToString     
SupplierNo = RegexMatch(0).Groups(2).ToString

Warm Regards,
Ranjith Udayakumar

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.