Store Values from Matches

Hi,

Is there a way or an expression that saves 4 values from matches output and 2 string variables in a data table row?
@prasath17

@rameezimtiaz - Is this related to the previous post, where we got 4 outputs??

If yes, How do you want to write the outputs?? please show us some sample??

Yes @prasath17 the thread was closed so i created a new post.
It should be something like this. On the left there is the code and on right how the excel should look like

@rameezimtiaz - Say you have Datatable with 6 columns created…You can add DataRow activity and code ArrarRow element as shown below.

{ProjectNo.tostring,RegexMatchtitleVar(0).ToString,RegexMatchDescVar(0).ToString,RegexMatchInfoVar(0).ToString,RegexMatchExpVar(0).ToString,PageNo.tostring}
1 Like

Thanks @prasath17

https://regex101.com/r/aPyPP0/1
regarding the regex above is it possible to just extract amount leading to the work total expenses?

@rameezimtiaz - check this out…

https://regex101.com/r/aPyPP0/2

1 Like

Getting 2nd error. getting the match but somehow i think there is no value in expenseVariable(0). But when I try to print expenseVariable i get the 1st error.
image

@rameezimtiaz - RegVar(0).tostring or RegVar(0).Value…please see the differences here…if you don’t (0)…you will get the first message

2nd error…As per the given text, i am getting the output…

Please check

image

@rameezimtiaz - Then text must be little different/different than what you have provided…that’s why it is not fetching…

Write the output of Read PDF Text activity to text file and share the text file here, to debug it…

@prasath17 yes the problem is that there are different amount of spaces in the text. Regex is fine if there is just 1 space between dollar sign and the amount but in the text it could different

@rameezimtiaz - Please try this…

(?<=Total Expenses\s+)\$\s+[\d,.]+
1 Like

Check the difference

image

image

This should solve the issue

But in this case, You want to write only the amount without $ sign? because writing above one looks ugly or you have to write Regexvar(0).tostring.replace(" ",string.empty)

@prasath17 i think with dollar sign works for me. secondly in the regex shared below instead of word street improvements can i use a variable?

https://regex101.com/r/dfm8Ji/1/

Personally I haven’t tried that before…you can refer this post…

@prasath17 is there any other way or any other regex that can fetch me this title?

I couldn’t get you…

https://regex101.com/r/dfm8Ji/1/

In this regex we are capturing title which is fine for this text. But the problem is that there could be any word before the title. so can we fetch this title using some different regex?

Assuming Project # will always there…we can try this…

https://regex101.com/r/dfm8Ji/2/