How to read data next to search word found

Hi All,

I wan to extract Amount when search word found.

Text Data: Company name currency JPY Gross Amount .1890 date 13/01/2022.

Output: .1890

How can I extract data after Gross Amount word found.

Thanks in advance
Niranjan

Using Regex could be an option:
grafik

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

Hi @Niranjan_k

Use the below regex

(?<=Gross Amount\s*)(.?\d+)
1 Like

@ppr @mkankatala thanks a lot both are working fine

@Niranjan_k

Check the below workflow for better understanding:

Input= "Company name currency JPY Gross Amount .1890 date 13/01/2022."
Output= System.Text.RegularExpressions.Regex.Match(Input,"(?<=Gross Amount\s*)(.?\d+)").Value

Happy Automation!!

@Niranjan_k
Perfect

when exploring Regex more e.g. for training purposes and the dot before the number is relevant have a look here

grafik
dot is included as we defined a character along with digits in the set of needed chars surrounded with

When using a pattern where the definitions are done within groups ( we do see the round brackets) the dot represents any character except \n

grafik
grafik

or we escape with \ and define the dot as char
grafik
grafik

So, as shown you will have control of the pattern.

When regex is new we can also recommend the explanations. Screenshot from above were done with Regex101.com and setting

grafik

Also have a look at this pattern, where group separators are optional and included
grafik

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