Code is matching in Regex but return nothing in UiPath

Hello,

I am trying to fetching the data from PDF. for that first I have converted PDF into Text file and try to match with Regex. in Regex it is giving me correct output but in UiPath Match activity give null result.

Below is my text file data.

Szolgáltatás típusa Küldemé- Összsúly Tételek Alapdíj Egyéb díjak ÁFA Összeg
nyek száma Kg száma összesen ÁFA-val

EXPRESS WORLDWIDE NONDOC 1 0,50 1 17,73 3,59 21,32
Összesen 1 0,50 1 17,73 3,59 21,32
Egyéb díjak részletezése Összesen

Regex I am using -
(?<=összesen ÁFA-val\n\n\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s)\S+

Regex Screenshot which gives correct result

UiPath Output

image

@nilesh.mahajan

From the matches activity properties…under options…select multiline option and then try

image

Cheers

Hi @nilesh.mahajan

Can you try to extract the data like this:

System.Text.RegularExpressions.Regex.Match(inputStr, "(?<=összesen ÁFA-val\n\n\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s)\S+").Value

Hope this helps,
Best Regards.

In Windows, a linebreak can consist of both a carriage return \r and a line feed \n. Test to change “\n\n” to “\r?\n\r?\n”.

(?<=összesen ÁFA-val\r?\n\r?\n\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s)\S+

Hi,

it might be line break matter. Can you try to use \r?\n instead of \n as the following?

(?<=összesen ÁFA-val\r?\n\r?\n\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s)\S+

Hello @nilesh.mahajan

Give this Regex Pattern a try:
(?<=.sszesen .FA.val[\n\r]+.+[\n\r]{2}.+)\d+,\d+(?=[\n\r])

Its more reliant on number of lines rather than exact word counts etc. It also is less sensitive to special characters.

Hopefully this helps :blush:

Cheers

Steve

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