Regex fix

Hi,
I am trying to match the amount in the following sentence

Total other Charges Due By: 2/15/2023 $4412.63

with the Regex
(?<=Total other Charges Due By:/d+//d+//d+/s+)(\s+$\d+,?\d+.?\d+)

It is not working. Not getting the amount. Can you help please ? Thank you,

@A_Learner
change to this

Total other Charges Due By: [\d]{1,2}\/[\d]{1,2}\/[\d]{4} (\$\d+,?\d+.?\d+)

get the value like this

System.text.regularExpressions.Regex.match(input, "Total other Charges Due By: [\d]{1,2}\/[\d]{1,2}\/[\d]{4} (\$\d+,?\d+.?\d+)").Groups(1).value

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Total other Charges Due By:\s*\d{1,2}/\d{1,2}/\d{4}\s+)\$[\d.,]+").Value

Regards,

1 Like

Hello @A_Learner

Try this pattern:
(?<=Total other Charges Due By:\s\d+.\d+.\d+\s\$)[\d\.\,]+

Cheers

Steve

@A_Learner

(?<=Total other Charges Due By:\s+\d+/\d+/\d{4}\s+)$\d+.\d+

Hey @A_Learner

You can try the below regex

($\d+,?\d+.?\d+)

So this will get all the digits present after the dollar sign
image

Hope this helps you out!

@A_Learner

Try the below regex expression

(?<=\d{4}\s+).?\d+\.?\d+

Or else if you wanted to remove the $ symbol then try this

(?<=\d{4}\s+.?)\d+\.?\d+

The below is the changed syntax of your regex expression

(?<=Total other Charges Due By:\s+\d+\/\d+\/\d+\s+)(.?\d+.?\d+)

Hope it works!!

Hi @A_Learner
$\d+(?:.\d{2})?

Hope it helps!!

Hi @A_Learner

Try this

(?=\$).*

image

I hope it helps!!

This solution worked for me. Thank you!

1 Like

Hi,
Regex in .NET Regex Tester - Regex Storm works. But when I use it in code using Match(), it returns nothing. I am not sure why?

Thank you,

Hi,

Can you share your project (xaml and data) if possible?

Regards,

Thank you! Some edit mistake. Working good.

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