Regular expression examples

The following patterns are given as examples, along with descriptions of what they match:

  • abc Matches the three letters abc in order.
  • a.c Matches any string that begins with the letter a, followed by any one character, followed by the letter c.
  • abc|def Matches "abc" or "def"
  • ab*c Matches "ac", "abc", "abbc", "abbbc"
  • ab+c Matches "abc", "abbc", "abbbc", and so on, but not "ac".
  • a(b*|c*)d Matches any string that begins with the letter "a", is followed by either zero or more of the letter "b" or zero or more of the letter "c", and is followed by the letter "d".