I have a name, "foo bar", and in any string, foo
, foos
, bar
and bars
should be matched.
I thought this should work like this: (foo|bar)s?
. I tried some other regexes as well, but they all were like this. How can I do this?
(foo|bar)s?
is correct...
You should use a boundary like \b(foo|bar)s?\b
. Else it would also match hihellofoos
.