Extraction of specific text from the Data

Hi all,

Could you pleas help me in Extracting the specific data from the test shown below.

D12345 First value (panoramic situation) – (limited to 1 D12345 or $0.00
D12345 every 10 years)

In this test I would like to Extract the Value in between the “()” which stars with Limit,Limited and ends with Month, months,year,years.

Could you please help me on this

Thanks
Sreenivasa

Here

find a first Regex pattern

we had set the IgnoreCase regex option

Thanks for the solution, Here how can we pass this value to a variable.

I am trying with the group functions, but throwing an error.

Could you please help me on this

Thanks
Sreenviasa

Assign Activity:

strText = System.Text.RegularExpressions.Regex.Match(yourInputTextVar, "(?<=\()LIMI[\s\S]*?(?=\))").Value

feel free to set also the pattern onto a variable like
strPattern = “(?<=()LIMI[\s\S]*?(?=))”

strText = System.Text.RegularExpressions.Regex.Match(yourInputTextVar, strPattern).Value

[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum

Thanks for the Reply,

I am facing this issue

I am unable to find what I did wrong. could you please help me on this

Thanks

your are not providing a proper input string to the regex.Match.
Not knowing your details in all it looks like missmatching different approaches into one approach

Just checkout the CheatSheet and get some trainings on how to use when looking to the different samples

1 Like

Hi @ppr

Could you please look in to this,

This is not matching the condition

check first that CaseIgnore option is enabled also unescape the ( e.g \( when used within the pattern

Hi @ppr

Yes its enabled but still same error

Thanks

please check

would recommend to check in

Hi!

Have you imported the namespaces from import panel?

If not follow the below steps:

  1. Open UiPath studio
  2. open your project
  3. Below next to the argument panel you can see the import panel click on that And search for System.Text.RegularExpression
  4. Your Expression would be
Assign strText = System.Text.RegularExpressions.Regex.Match(yourInputTextVar, "(?<=\()LIMI[\s\S]*?(?=\))").ToString

Regards,
NaNi

Thanks For your reply tarun,

I Had imported the namespaces, but unable to extract the required value. please see the below image

Did I missing any thing ?

I want the text in between the “()” starting with the Limi or limited and ends with Year, years, month, months

Thanks
Sreenivasa

@srinusoft37 Try below attached workflow

Example.zip (2.9 KB)

Input

Output

Capture1

1 Like

Hi!

Try this out:

System.Text.RegularExpressions.Regex.Match(TextValue,"(?=Limit|limit|limited|Limited to ).*[\n\r]+.*(?<=Month| month|Months|months|year|Year|years|Years)").ToString

Reference:

Regards,
NaNi

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