Hello! I am reading in PDF data and need to pick out a specific value from a block of text. The value is static in it’s position within the block no matter what page I read in, however, the amount of characters is dynamic. The block of text I am working with is as follows:
I am trying to pull out the second dollar amount so in this example I should get 6,147.10 as an answer.
Using a regex expression generator (https://regexr.com/) I am able to pull the value out successfully using the expression: (?<=$)\S+$|(?<=$)\S+ $
However, when I try it in UiPath by assigning a variable to the code: system.Text.RegularExpressions.Regex.Match(str_ResVolAmt,“(?<=$)\S+$|(?<=$)\S+ $”).ToString, no value is pulled out.
Thank you for jumping on this A couple of quesitons for follow up:
I need to build the processing using the enterprise version of UiPath, so is the UiPath.Core.Activities.Matches activity part of that edition?
The expression successfully parsed out the values after every $ and assided them to each index. I have a more advanced problem where the position or index of the value might change. The example I have is as follows:
Fees
Description Fee Unit Fee Quantity Fee Rate Fee Value
Electric gal 15,524.01 0.011391 $176.83
Low Volume USD 0.00 400.000000 $0.00
Marketing Fee gal 15,524.01 0.057579 $893.85
Marketing Fee mmbtu 3,787.11 0.046063 $174.45
Processing mmbtu 5,690.48 1.957675 $11,140.11
Transportation gal 15,524.01 0.000000 $0.00
Total $12,385.24
I need to pull 174.45 from the line that starts with “Marketing Fee mmbtu”, but the position of that line will change occasionlly. Any thoughts?
Yes, techincally I do need to pull values from the “Fee Value” column. I want to be careful saying that however, becasue I need value from that column as well as a select amount of lines such as “Marketing Fee mmbtu”.
@Robert_Schauer The following expression would pull out all non-white space characters from the line containing “Marketing Fee mmbtu”: (?<=Marketing Fee mmbtu.*\$)\S+
Brilliant! That worked, and additially, I should just be able to change the string that is being used for the positive lookbehind function to find my other values. @SowmyaLeo thank you for your help as well!