So far.. I have this test string:
Hello {John|Paul|Cindy}, hows {david}?
and my expression is:
(\{\w+\})
However, it only returns david. I want to be able to grab John, Paul, and Cindy.
There would only be 0 or 2 vertical bars. any ideas?
Thanks
If it’s not some kind of competition, I would simply use two regular expressions:
{[\w|]+}to grab each pair of curly brackets along with its content, then, on each result,\w+to extract words.You can’t go simpler using just one regex.