You want to understand the basic building blocks of regular expressions.
Regular expressions are built by combining characters with special meaning. First start by learning the basic patterns, and then use this knowledge to put together more complex patterns.
A regular expression is a pattern constructed using the regular
expression syntax and is typically used during text processing and
pattern matching. The syntax consists of characters,
metacharacters, and metasequences. Characters are interpreted
literally, whereas metacharacters and metasequences have special
meaning in the regular expression context. For example, the regular
expression built from the characters
hello matches the string “hello,” whereas
the regular expression consisting only of the
. metacharacter means “any character” and
matches “a”, “b”, “1”, etc. Additionally, the regular expression built
from using the
matches any digit, such as “1” or “9”.
Before getting too in-depth with the regular expression syntax,
let’s start by discussing how regular expressions are created in
ActionScript 3.0. Regular expressions are built with the RegExp class and can be constructed from
either a string describing the pattern or from a regular expression literal. A regular
expression literal is a forward slash, followed by the regular
expression pattern, followed by another forward slash, such as
/. The following code demonstrates how ...