beautypg.com

Visara Master Console Center Scripting Guide User Manual

Page 59

background image

Chapter 4 Regular Expressions

Scripting Guide

59

The rules in Table 9. Bracket Expression Rules. apply to:

ƒ

Creating and using matching and non-matching list expressions.

ƒ

Collating symbol.

ƒ

Equivalence class expression.

ƒ

Character class expression.

ƒ

Range expression in bracket expressions.

Bracket Expression
Rule

Description

Matching List
Expression

Specifies a list that matches any character or
collating element in the list. The first character

in the list cannot be a circumflex. [a3] matches

either the character a or the character 3.

Non-matching List

Expression

Specifies a list that matches any character or

collating element except for the expressions in
the list after the leading circumflex. A non-

matching list expression begins with a

circumflex “^”.
For example, [^abc] is an RE that matches any

character or collating element except the

characters a, b, or c. If the circumflex does not
appear immediately following the left bracket,

it loses its special meaning.

Collating Symbol

A collating element enclosed within bracket-

period “[. .]” delimiters. Multi-character

collating elements are represented as collating
symbols to distinguish them from the individual

characters in the collating symbol.
For example, when using Spanish collation

rules, [[.ch.]] is treated as an RE matching the

sequence ch, while [ch] is treated as an RE
matching c or h. In addition, [a-[.ch.]] matches

a, b, c, and ch (see Range Expression later in

this table). Collating symbols are valid only
inside bracket expressions.

Character Class
Expression

Delimiters enclosed in bracket-colon “[: :]”
match any of the set of characters in the named

class. Members of each of the sets are
determined by the current setting of the

LC_CTYPE environment variable. The

supported classes are: alpha, upper, lower,
digit, alnum, xdigit, space, print, punct, graph,

and cntrl. Here is an example of how to specify

one of these classes: “[[:lower:]]”. This matches
any single lowercase character for the current

locale within the string.