Regular expression Number extraction

Hi All,

I have some data on CSV file and I want to extract only highlighted portion.
Can anybody help me how can I use regular expression on this.

I am pasting some values also attaching image file.

2 of 3) Account Number 09 7167 21411234 8419.18039.1.2 ZZ258R3 0303 SL.R3.S931.

1 of 3) Account Number 09 7167 21411234 Statement Period 1 Dec 2021 -

2 of 3) Account Number 09 7167 21411234 8419.18039.1.2 ZZ258R3 0303 SL.R3.S931.

1 of 3) Account Number 09 7167 21411234 Statement Period 1 Dec 2021 -

2 of 3) Account Number 09 7167 21411234 8419.18039.1.2 ZZ258R3 0303 SL.R3.S931.

1 of 3) Account Number 09 7167 21411234 Statement Period 1 Dec 2021 -

Thanks
AN

Hi @anand.t,

Check this

(\d+\s+\d+\s+\d+)

Input

Output
image

Code:

(System.Text.RegularExpressions.Regex.Matches(st,"(\d+\s+\d+\s+\d+)")).ToArray

Thanks,

Hi @anand.t ,

Could you Check with the below Regex Expression :

(?<=Account Number)\s*\d+\s+\d+\s+\d+

Expression to get the value from the Input :

Regex.Match(InputStr,"(?<=Account Number)\s*\d+\s+\d+\s+\d+",RegexOptions.IgnoreCase).Value.Trim

Here, InputStr is the data present in each row assuming you are looping through the csv data.

Let us know if you are not able to get the output.

Thanks it work for me.

Regards
AN

1 Like

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