I need to retrieve digits before enter key and the space before it using regex.
I have used the following expression to extract data from the pdf file.
[a-zA-Z]{2}\/\d{10} \d{2}.*
PH/2400310945 01.09.21 MYDOWNLOAD 19307.92- 0 **-19,307.92**
PV/5992278688 23.09.21 99140806 184832.4 144.40 **184,688.00**
PV/5992278699 23.09.21 99140807 13939.6 10.89 **13,928.71**
PV/5992285849 24.09.21 99140824 95845.48 74.88 **95,770.60**
PV/5992286716 24.09.21 99140822 73321.58 57.28 **73,264.30**
PV/5992286738 24.09.21 99140823 246443.22 192.53 **246,250.69**
Now I need to extract only the last part which is highlighted in BOLD, My requirement is that I need to extract all digits from enter until the previous space which i failed to achieve using split string in uipath since the digits are dynamic in length.
Appreciate you inputs for the same.
This is how the data looks in IEnumerable
I have tried all the following
Regards, Manjesh
CodePudding user response:
Instead of using split, you can match the numbers at the end of the string, including the leading space.
-?\d (?:,\d{3})*(?:\.\d{2})?$
For example
System.Text.RegularExpressions.Regex.Match(s, @" -?\d (?:,\d{3})*(?:\.\d{2})?$").Value;