Regular Expression & Parsed Elation

Jul 4, 2008

Here’s a little app I wrote during a project to test ActionScript 3’s regular expressions.

Character Classes —————–

  • \w - word character [A-Za-z0-9_]
  • \W - non-word character [^\w]
  • \s - space character [ \t\r\n]
  • \S - non-space character [^\s]
  • \d - digit [0-9]
  • \D - non-digit character [^\d]

Quantifiers

  • ? - zero or one
  • \* - zero or more
      • one or more
  • \{min, max\} - ranged selection

Avoiding Back-tracking

Negative boundary matching

/”[^”]*”/ - match all characters between double quotes

Atomic Groups

/”(?>[^”]*)”/ - drops positions after a match is made