Regular expression to keep value only

Dear all,

I am going to del character in my text file and finally I would like to import to excel file.

However, my text file contains different part like following:

abcd ( ) jkhds page 2008
hjkd kjsd iuwe 229 hhh
00123 32 1223 322

ENTER ADDITIONAL SPACE
abcd ( ) jkhds page 2008
hjkd kjsd iuwe 229 hhh
00123 32 1223 322

ENTER ADDITIONAL SPACE
abcd ( ) jkhds page 2008
hjkd kjsd iuwe 229 hhh
00123 32 1223 322
ENTER ADDITIONAL SPACE

Actually I would like to keep only the row 00123 32 1223 322
and the result as follows:

00123 32 1223 322
00123 32 1223 322
00123 32 1223 322

my expression is as follows: System.Text.RegularExpressions.Regex.Match(myText, “(?sim)(?<=hhh).*(?=ENTER ADDITIONAL SPACE)”).VALUE
However, it doesn’t work.
Could anyone please help?
Many thanks!

@raymondhui Use this Regex

Thx for your website bro but would you like to explain further as I am not really understand the website?

And how to implement in UiPath?

Many thanks

Just use this in in an Assign Activity or using a Matches activity.
Read your text file and store it as a String variable.
Use
Regex.Matches(yourString,"image ")

[\d ]+ [\d]+(?=\n) this pattern will be fetched from your text file after you read and pass it as a string variable.
.
which will return an array of results
like below.

It will return an IEnumerable of matches and you can loop through each match as a String.

@raymondhui Check attached zip file its working as you need RegexForSamePatternInTextFile.zip (11.9 KB)

After I store it and tried to print it out it only returns “System.Text.RegularExpressions.Regex.Matches”.

Thx bro but I can’t open it in my robot, activity is disable.

@raymondhui Can you share screen shot of disabled activity

Attached is for your ref. Bro

@raymondhui Its for each activity see attached screen shot.

Would u like to show me the details of ismatch activity and the following bro?

@raymondhui check this

1 Like

Good work!

Hi @rangaprakash,

Using matches activity you can give the pattern & input
in for each you can get the value of your matching pattern.