I want to match either foo bar baz or bar baz foo. foo can be in either position, but it must be present. I’m not too familiar with lookaheads, and look behinds, but I feel like that’s got to be the way to do it. Any tips?
I want to match either foo bar baz or bar baz foo . foo
Share
There may be a cleaner way to do this, but the following should work:
http://www.rubular.com/r/7wEVNi5G1Q
Alternatively, you can just use
|to match one option or the other: