How to provide regex

~DATA UPDATION (140 HOURS)~-~120690.00

~TOTAL AMOUNT~56478.80
The output which i need to extract is 120690
I tried to provide regex as (?<=DATA UPDATION(140 HOURS)).* This is static it will comes as 140 hours or 2 hours.

Hi @Chippy_Kolot

How about this expression?

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=DATA UPDATION\s.)(\d+.\D+)(\d.+)").Groups(2)

image

Regards
Gokul

1 Like

you can

System.Text.RegularExpressions.Regex.Match(YourString,“(?<=DATA UPDATION\s.)(\d+.\D+)(\d.+)”).Groups(2)

this regex provided by @Gokul001

after that output.split("."c).toarray(0).tostring

you can use like that

@Chippy_Kolot
Kindly try this

System.Text.RegularExpressions.Regex.Match(System.Text.RegularExpressions.Regex.Match(YourString,"(?<=~DATA UPDATION)").Tostring.Trim,"(?<=~)[\d.]+").ToString.Trim

@Chippy_Kolot
Also, try this

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=~\W~)[\d.]+").ToString.Trim

Or

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=~\W~)[\d.]+(?=\n)").ToString.Trim

image

Hi @Chippy_Kolot ,

The Pattern of the String is similar to a previous post created by you :

You could take the Solution from one of the posts provided there which best suits the pattern, For your current case, you would just have to replace the Key (CLASS TIME) with your current Key (DATA UPDATION)

(?<=DATA UPDATION.*?~)[\d.,]+

image

Also note that your previous post was not marked as Solved.

Hello @Chippy_Kolot - Minor change to your expression

(?<=DATA\s+UPDATION\s+\(140\s+HOURS\).*)\d.*