Regex expression to extract numbers

I would like to extract a specific number; ie 25,000.00 but would like to remove the spaces and UNITED STATES OF. I can’t seem to have \s+ inside a ?<=

Regex expression as follows:
System.Text.RegularExpressions.Regex.Match(strInvoiceText,“(?<=PAID-UP ,ORDINARY)(\s+UNITED STATES OF\s+)[\d.,]+”).Value

Appreciate the help in advance!

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Match(strInvoiceText,"(?<=PAID-UP ,ORDINARY\D+)[.,\d]+").Value

Regards,

1 Like

@Justine ,

Maybe a Correction in the expression would work :

(?<=PAID-UP ,ORDINARY\s+UNITED STATES OF\s+)[\d.,]+
System.Text.RegularExpressions.Regex.Match(yourText,"(?<=PAID-UP ,ORDINARY\s+UNITED STATES OF\s+)[\d.,]+").Value
1 Like

Hi @Justine

How about this expression?

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=PAID-UP ,ORDINARY)(\s+UNITED STATES OF\s+)([\d.,]+)").Groups(2)

image

Regards
Gokul

1 Like

hi @Yoichi , thank you and appreciate the help!

hi @supermanPunch , thank you and appreciate the help!

1 Like

hi @Gokul001 , thank you and appreciate the help!

1 Like

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