Regular Expressions

A regular expression is a string of characters used for string matching. A sequence of characters that conforms to the pattern of characters defined by a regular expression, matches that regular expression. For example, the following regular expression matches the words bat, bet, bit, bot and but:

b[aeiou]t

A regular expression also defines strings of characters because it is an expression that contains literal characters and meta-characters, which are characters that have reserved meanings and can represent different patterns of literal characters.

A regular expression can be a Basic Regular Expression (BRE) or Extended Regular Expression (ERE). The difference is that EREs are more flexible and recognize more meta-characters than BREs.

You can program string-matching using regular expressions by calling functions in the IBM C and C++ Compilers run-time library.

If you build or customize a locale, you may have to use regular expressions to define strings that represent elements of the cultural environment you are defining.

When you perform string-matching with regular expressions, the collating rules of the active locale control the matching process.



Localization and Locales


Program String-Matching with Regular Expressions


Matching Rules for Basic Regular Expressions
Matching Rules for Extended Regular Expressions
Bracket Expressions in Regular Expressions
Additional Syntax Specifiers for Basic Regular Expressions
Additional Syntax Specifiers for Extended Regular Expressions
Order of Precedence in Basic Regular Expressions
Order of Precedence in Extended Regular Expressions