Need to extract text position and its values in text file

Hi Everyone,

I do have a text and need to find text and extract text after value in text file.

Need to find the word “FILTRATION AREA” if its found need to extract its value “0.12 m” and text look like

“FILTRATION AREA: 0.12 m”

Please kindly refer the given attachment file.

TEST_TextFile.txt (2.3 KB)

Thank you!

Hi @victoryv4569

(?<=FILTRATION AREA:\s+)\d+\.?\d+\s*[a-z]+

Regards

1 Like

HI @Parvathy

How to use it in UiPath.

Thank you!

Hi @victoryv4569

=> Read Text FIle
Output → str_Text

=> Use the below condition in If

If
 System.Text.RegularExpressions.Regex.IsMatch(str_Text,"FILTRATION AREA")
Then
   Assign -> Value = System.Text.RegularExpressions.Regex.Match(str_Text,"(?<=FILTRATION AREA:\s+)\d+\.?\d+\s*[a-z]+").Value.Trim()
End If

=> Print Value in Message Box or Write Line

Sequence34.xaml (8.4 KB)

Regards

1 Like

Hi @victoryv4569

Hope it helps!!

1 Like

Hi @victoryv4569

Can you try the below

If(System.Text.RegularExpressions.Regex.IsMatch(TextFile,"FILTRATION AREA"),System.Text.RegularExpressions.Regex.Match(TextFile,"(?<=FILTRATION AREA:\s?)(\d+[.,]\d+\s?\w+)").Value,String.Empty)

Regards,

1 Like

Hi @victoryv4569

Try below expression in Assign Activity

str_Input= yourText (FromPDF)

System.Text.RegularExpressions.Regex.Match(str_Input,"FILTRATION AREA:\s*([^:]+)").Groups(1).Value.Trim

Hope it will helps you :slight_smile:
Happy Automation

1 Like

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