Need to find string(word) position and next find or extract word right side 5 charecters

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”(i need to extract the value till “m” every time) and text look like

they are in different formats like,

“FILTRATION AREA: 0.12 m or “FILTRATION AREA: 0.072m" | Tm | om Se or
“FILTRATION AREA: 0. 1! 37m’ | ph 5 > "a 5 or “FILTRATION AREA: 0. 055m’ S| =i or “FILTRATION AREA: 0. 072m | Sel or “FILTRATION AREA: 0. 1! 37m’ | ph 5

Result should be like below:
0.12 m or 0.072m or 0. 1! 37m or 0. 055m or 0. 072m or 0. 1! 37m

Thank you!

1 Like

Hi @victoryv4569

Try this

(?<=FILTRATION AREA:\s*)(\d+[.,]\s?\d+(\!)?\s?\d+\s?\w+)

Regards,

Just use RegEx

(?<=FILTRATION AREA:)(.*)(?=m)

image

After getting the value, Trim it to remove any leading or trailing spaces.

Hi @victoryv4569

Try this syntax:

System.Text.RegularExpressions.Regex.Match(str_Input,"(?<=FILTRATION AREA\:\s*)\d[\s\S]*?m").Value.Trim()

Regards

@victoryv4569

Try regex

(?<=FILTERATION AREA\:).*(?<=m)

Cheers

Hi @vrdabberu

How to use it in UiPath ?

Thank you!!

Hi @Anil_G

how to use it in UiPath ?

Thank you!!

hi @lchirathapudi

How to use this in UiPath ?

Thank you!!!

Hi @victoryv4569

=> Read Text File
Output-> str_Input

=> Use below condition in If

If
  str_Input.Contains("FILTRATION AREA")
Then
   Assign -> Value = System.Text.RegularExpressions.Regex.Match(str_Input,"(?<=FILTRATION AREA\:\s*)\d[\s\S]*?m").Value.Trim()
   Message Box -> Value
End If

Output:

Regards

1 Like

@victoryv4569

System.Text.RegularExpressions.Regex.Match(Input,"(?<=FILTRATION AREA:\s*)(\d+[.,]\s?\d+(\!)?\s?\d+\s?\w+)").Value

1 Like

@victoryv4569

You can use it in matches activity

Cheers

1 Like

https://forum.uipath.com/search?q=how%20to%20use%20regex

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