Remove text before a word

I’m trying to remove everything in a sentence that comes before a certain word. Problem is it’s random except for the word I’m trying to keep. Example: “Hello World 403 !It’s Me IMPORTANT” and I want to keep only IMPORTANT.


You can use Regex to achieve this! Try using this link to preview/play with the result.

In UiPath Studio - use an Assign activity like this.
Str_Variable = System.Text.RegularExpressions.Regex.Replace(YOURINPUTSTRING, “[\s\S]*(?=IMPORTANT)”, “”)

GIve it a go :slight_smile:


Works flawlessly, thanks!

1 Like

Hi again

If you want to match only text on the same line prior to “IMPORTANT” then you could use:


1 Like

Thanks a lot, I’ll keep that in mind

1 Like

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