Regex string extraction

Hello,
I have a string that is part of a whole paragragh. the string of the length keeps changing but I only need the last 6 characters of the string.
E.g.
We have made a payment to your account XXXXXX8114 at ABC as instructed by XYZ.

The string in bold can change length, can be XXXXXXXXXXX8114, so at any one point, I would want only the last 6 digits. so XX8114.

Kindly help.

Hi @Lydia_Gathoni

How about this expression?

System.Text.RegularExpressions.Regex.Match(YourString,"\S\S\d{4}").Tostring

Or

System.Text.RegularExpressions.Regex.Match(YourString,"\S{2}\d{4}").Tostring

image

Regards
Gokul

2 Likes

2 Likes

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