How to extract the 5 digit no from below? that is 71372

Cost Center: ACO-Fannie Chow (71372)

hey

try this
System.Text.RegularExpressions.Regex.Replace(“string_Variable”,"\D","")

regards

@aparna30 You can get this using regular expressions

System.Text.RegularExpressions.Regex.Match(InputString, "(?<=Cost\s+Center:\s+ACO-Fannie\s+Chow.*)\d{5}").ToString

Please find the sample workflow below

Example.zip (2.2 KB)

Hi @aparna30 ,

You Could try the Below Approach as well and Let us know if it works for all Cases :

(?<=Cost Center:).*(?<=\()(\d+)

image

System.Text.RegularExpressions.Regex.Match(textData,"(?<=Cost Center:).*(?<=\()(\d+)",RegexOptions.IgnoreCase).Groups(1).Value.ToString.Trim