Dynamic regex to extract final amount

I have a text format given below:
Transaction Details
Report generated on JUL 13,2020 09:14:10 by BRYAN DSOUZA
Account Number: 104575473 / IBAN Number: BH52BBKU00123646445763
Account Name: VIP LIMITED BSC CLOSED VIVA / Date Range: 01/06/2020 to 30/06/2020
Number of Records: 9

Transaction Date Value Date Narrative Cheque reference number Debit Credit Running Balance
01-06-2020 01-06-2020 Credimax-. 06300955 BTC - - 0.000 19,338.914 49,643.333
UK
01-06-2020 01-06-2020 Credimax-. 06300954 BTC - - 0.000 3,807.504 30,304.419
UK
01-06-2020 01-06-2020 Western Union-. 06300953 BTC - - 0.000 58.845 26,496.915
C IVR
01-06-2020 01-06-2020Credimax-. 06300952 BT - - 0.000 240.672 26,438.070
UK BSC
01-06-2020 01-06-2020 Western Union-. 06300950 BTC - - 0.000 21,245.788 26,197.398
UK
01-06-2020 01-06-2020 Credimax-. 06300001 BTC - - 0.000 4,451.610 4,951.610
UK

Page 7 of 7

This is format of the text, can anyone provide regex to extract final running balance. In the above text, it is 4,951.610

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"[\d.,]+(?=\D+?\nPage)").Value

Regards,

1 Like

Hi @Mohammad.Fuad

Can you try with this Regular expression?

System.Text.RegularExpressions.Regex.Match(YourString,"[0-9.,]+\n(?=UK\n\nPage)").Tostring

Regards
Gokul

1 Like

Hi @Mohammad.Fuad

Try this:
System.Text.RegularExpressions.Regex.Match(inputString,"([\d,]+\.\d+)(?=\s*[A-Z]+\s*Page)").Value

1 Like

Hi @Mohammad.Fuad

You can use the below regular expression to extract the required output.
Store the Input data in a Variable called Input.

- Assign -> Output = System.Text.RegularExpressions.Regex.Match(yourstringinput.ToString,"([0-9,.]+(?=\s+\w+\s+Page))").Value

Hope it helps!!

1 Like

Hi @Mohammad.Fuad

Try this regex:

System.Text.RegularExpressions.Regex.Match(strtext,"[\d,.]+\n(?=[A-Z\s*]{2,}\s*\sPage)").Value

Hope it helps!!

1 Like

@Mohammad.Fuad

System.Text.RegularExpressions.Regex.Matches(str,“(?<=\s)\d+,\d+.\d+(?=\s|$)”).Last.Value

1 Like


You can refer the above regex pattern
[0-9,.]+(?=\s[A-Z]+\s(\nPage))

1 Like

@Mohammad.Fuad can also try with this regex :\d{1,},?\d{1,}.?\d{1,}(?=\s[A-Z]+\n\s[A-Z0-9a-z ]+\d{1}\n+$)

1 Like

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