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

Standard Meta Characters

The Character Class

  • Matches a list of characters.
  • A caret (^) at the beginning of the list causes it to match only characters that are not in the list.
  • The order of characters in the list doesn't matter.
  • You may use a hyphen as a range delimiter, as in [a-z0-9], which is equivalent to \w
  • If you want to match a caret, don't put it first.
  • If you want to match a right bracket (]), don't put it last.
  • Another option is to backslash these characters.
  • Most characters loose their meta-ness inside square brackets.
  • Since each character in the brackets is interpreted individually, it is meaningless to specify alternation with the vertical bar. A vertical bar is simply a vertical bar in a character class. So [fee|fie|foe] means the same as [feio|].

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