Get the next word

Hello, I have a problem that I need to get the next word in a string variable.

How that works is after finding the “☒” character I want to take the word after it (basically checked one) to add it into a collection.
How can I only take the words that are “checked”?

image

Here is an example of one of my string variable

Hi @Paul_Andrei_Turcu

You can make use of regex

image

System.Text.RegularExpressions.Regex.Match(strVar, "☒\s(\w+)").Groups(1).Value

Thank you, that works perfectly but the problem is that in one of my cases my words contains also a “-” character, such as:
image
And it only gets the “s” or the “b”

Hi @Paul_Andrei_Turcu

Try this

System.Text.RegularExpressions.Regex.Match(strVar, "☒\s([^☐]+)?").Groups(1).Value

I think that may just do the trick

Thank you soo much!

1 Like

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