Replace specific words in text

Hi, Could you please suggest me to replace " " in text?
Text = “xxxxxxx Enter yyyy Enter”

Result = “xxxxxxx”

How should I do?

Hi,

How about the following?

Result = System.Text.RegularExpressions.Regex.Match(text,"^\S*").Value

Regards,

Thank you for your suggestion but it still not work.
May be my example is not clear.

Text = " xxxxxxxxx yyyyyyyyyyyy tttttttttt Example bbeeee mmmm Example ooooo"
Result = " xxxxxxxxx yyyyyyyyyyyy tttttttttt"

by your suggestion result is only “” xxxxxxxxx"
Please help mw again.

Hi,

Do you want to extract words ahead of the first “Example”?
If so, the following will work.

System.Text.RegularExpressions.Regex.Match(text,"^.*?(?=Example)").Value

Regards,

Yessss, It’s workkk

Thank you very much :slight_smile:

1 Like

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