You are here

2 November 2014
PCRE regular expression operator OR. In regular expressions "or" is known as "alternatives". Create a subgroup using parenthesis.

Text

Source code viewer
  1. browse-tutorials.com/snippet/regex
  2. browse-tutorials.com/tutorial/regex
  3. browse-tutorials.com/video/regex
Programming Language: Text

Regular expression

Source code viewer
  1. /browse-tutorials.com\/(snippet|tutorial)\/(.*)/
Programming Language: PCRE

Result

Only the first two will match.