An Introduction to Regular Expressions The Basics 16 of 50 : [PREV] [NEXT]

Standard Meta Characters

Alternation

Regular expressions can include non-assertions, such as the alternation operator, which is indicated with a vertical bar:

/Homer|Marge|Bart|Lisa|Maggie/

Any of those strings can trigger a match. That is, the preceding expression matches all of the following strings:

  • "Homer"
  • "Bart"
  • "Lisa Simpson"
  • "Simpson, Marge"

© 2003 Barbie barbie@missbarbell.co.uk Home http://birmingham.pm.org/