I need regular expression for below following text

Hi,

i have the text in below format. I need to use regular expression to extract the text after “:” colon of each row and store in separate variable.
Ex- Billing date in str_billindate-variable
plant in str_plant_variable.
Like that individual regular expression is required for each row of prefix text as mentioned below.
Can anyone please help me regarding this.
Note - Regular expression should take text only after “:” colon to end of that line only,it should not go to next lane text or should not consider next line text.

((Billing date: 2022-01-30
Plant: TI99
Payment Term: TLN
Clearing: 94130000
Assignment: T2K - CO0001
Collective number: T2K
Tax Code: 0899
Employee Respons: 11110950
Description: PM PRICE ADJUSTMENT
Posting Text: Compensation for the period of July to December 2020 according to distribution agreement signed on 01.01.2014.
Block Payment: False
Invoice Sending Instructions: srikanth@xyz.com; Srinath.x@xyz.com;
))

Any online source where we can have regular expression for entered text, is also much appreciated.

Regards,
Srikanth

What about generating a datatable with the column separator as “:”?
Will need some cleanup, you need to be sure that there is going to be only one colon per line, and check what is the line break in your case.

Then depending on your need - you can either build a dictionary, or just loop through the DT as needed, lots of flexibility.

Hi!

Check the link: regex101: build, test, and debug regex

Regards

Hi

The website that is most compatible with UiPath is RegexStorm.net. This is the best place to test your Regex Patterns. (However the best place to learn IMO is Regex101.com but its not fully compatible with UiPath.)

As for the solution you have two options:
Solution #1: Here is a solution as you requested.

If the template changes however your solution will break and the order will be out. I would have a regex pattern for each value you need to extract. Like so:

Here is a pattern you can use to capture any values which is followed by a colon
“:” and a space " "
(?<=INSERTxWORD:\s).*

If you want to learn Regex - check out Regex MegaPost.

Then the more advanced option will be to insert these values into a Dictionary (so it can be easily passed around the workflow).

Hopefully this helps :blush:

A post was split to a new topic: Unable to access elements in new tab of a browser

Working with the following pattern we can grab dynamically the label and the value:


(.*)(?:\:)(.*)

we do use the groups for it and trim /cleanse the values e.g. with trim

for the codings have also a look here: