How To Get All Words from a Text File using RegEX?

Dears,

How To Get All Words from a Text File using RegEX in UiPath?

Thanks in advance

give a try on following pattern \b.*\b

1 Like

How about this pattern:
[a-zA-Z]+

1 Like

Dear @Steven_McKeering , It’s working but words with Capital Letter at the beginning split it into 2 Parts :
Example :
UiPath => Gives “U” and “ipath” ?

Hmmm are you sure your sample doesn’t have a space?

Preview link

Try this pattern.
[A-z]+

Or this pattern instead.
\w+

Sure there is no space
Neither of them is working :roll_eyes:

How are you using Regex?

Are you using the ‘matches’ activity or an assign?

I’m using Matches Activity

tugna

Under RegexOptions, be sure to select multi line.

How are you checking it’s not working?

I got the issue, seems is related to some sepcial Characters ( non-latin ones), like :
když nechci jít osobně na pobočku? gives:
tugna

Okay, you have two options.

  1. Use @ppr’s pattern. Or.
  2. Clean the string first, then apply my pattern. Note this will remove those characters.

See Section 6 of my Regex Megapost

image

1 - @ppr’s pattern => Keep sentense as it is

tugna
2 Clean the string first, then apply my pattern. Note this will remove those characters. => I don’t want to clean those characters, I need them as they are parts of my words :slight_smile:

I’m checking this topic, seems very interesting …I will update.

If you want to keep the words and letters exactly as they are then try this pattern:

[^\s]+

Preview link

1 Like

Great !!! @Steven_McKeering This is exactly what I want :slight_smile:

1 Like

We got there in the end :sweat_smile:

1 Like

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