Reputation: 203
I'm having trouble figuring this out. I'll admit i suck at regex, but here's the basic idea:
Let's say you have the string
word "two words" word2
How would i get a regex together to match 'word' and 'word2', and at the same time match 'two words' as it's own match?
Upvotes: 0
Views: 48
Reputation: 62676
You can use something like this:
((\w+)|"([ \w]+)")
Here is a regex101:
https://regex101.com/r/eT7CdJ/1
Upvotes: 2