4.5 Regular Expressions

A regular expression is a formula for matching text strings that follow some pattern. Regular expressions are made up of normal characters and metacharacters. Normal characters include uppercase and lowercase letters and digits. Metacharacters have special meanings. The following table contains some of the most common metacharacters and their meanings.

Table 4-3 Common Regular Expressions

Metacharacter

Description

.

Matches any single character.

$

Matches the end of the line.

^

Matches the beginning of a line.

*

Matches zero or more occurrences of the character immediately preceding.

\

Literal escape character. It allows you to search for any of the metacharacters. For example \$ finds $1000 instead of matching at the end of the line.

[ ]

Matches any one of the characters between the brackets.

[0-9]

Matches a range of characters with the hyphen. The example matches any digit.

[A-Za-z]

Matches multiple ranges. The example matches all uppercase and lowercase letters.

(?u)

Enables Unicode*-aware case folding. This flag can impact performance.

(?i)

Enables case-insensitive matching.

The Argument Builder is designed to use regular expressions as defined in Java. The Java Web site contains further information.