How to extract the first word from a string using RegEx?


I have a variable with the following text in it:

Jason joined! Say 'hello'!

I need to save the name Jason into a different variable. It can be any other name, but it surely is a one word and it is the first one in the string.

Do I need to search the string for the first 'space' and save every letter using a loop before the space is found or there is another way of doing this?

Thank you

1 Like

No need for a loop. If you want is the first word in a string, that's fairly easy.

Regex: ^\w+

In a macro:



Thank you!

1 Like

Thanks @gglick

1 Like