I have a Regex question, I have to recognize tokens in a text that looks like:
Foo-Followed by either bar, or bazfollowed -, then some of the figures, for example:
Foo-bar-010
Foo-baz-101
Then I want to split my matches like this: Foo-bar -010andFoo-baz -101
My regex is as follows:
(Foo-(bar|baz))-[0-9]+
This is cool, but I donβt want to define a group for the sentence βbarβ or βbazβ, as it negatively affects my results.
Any idea to get this result with just one group?
Vinzz source
share