Regarding the usage of REGEX to extract data

Hi team

I am facing an issue

I used to read data from pdf which was successful. Now i am trying to extract the data from the text using regex. So i applied the below regex pattern

But when i applied same regex pattern in the robocorp it is not extracting

Any reasons why ?

@Teppo @osrjv

Regards

Nived N

Hi, I didn’t quite understand what you mean by applying regex pattern in the robocorp - but if you have a string in Robot Framework code, you can extract parts of it with https://robocorp.com/docs/libraries/built-in/string/keywords#get-regexp-matches

Hi @Teppo

To extract based on some patterns in string we can use regex (Regular expressions)

So i was trying to extract some data in string using regular expressions which i had shown in figure above. The pattern was able to extract the data as checked in regex101 website (shown in image in my earlier query)

when i used the same regex pattern to extract the data in the string in robocorp lab, it is not working.

I used Get Regexp Matches keywords to extract the data from sting using the above regex pattern,

I am wondering why it is not working?

Is the regular expression pattern used in python robot framework is different?

May i know that ?

Regards

Nived N

Hmm :thinking: It seems to be working. Can you see some differences in your and mine code:

Mine it is not working

Let me check again @Teppo

One difference I note is that in Nived’s example the source string continues after the “OrchestratorSeller”. Maybe that affects the matching?

That is just a screenshot problem, here is the whole task:

*** Task ***
Test
  ${a}  Set Variable  xcelCult InventoryManagementProduct Name : OrchestratorSeller : uipathPrice : 10000Action : Insert
  ${b}  Get Regexp Matches  ${a}  (?<=Product Name : ).*(?=Seller)
  notebook print  ${b}