Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Pattern to capture words certain words in any order

$
0
0

I have the following strings :

  • combine (valid)
  • combine, online, store (valid)
  • store online (valid)
  • online (valid)
  • combine, anything else (invalid)
  • anything else combine (invalid)
  • combine-online (invalid)

I would like to have a regex that captures only if any of those 3 words (combine online or store) are present in any order and are only separated by a comma or multiple spaces.

It should be something like

[online|store|combine]\w+

Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>