UNIX Regular Expressions

 

 

 

UNIX Regular Expression

 

Definition

 

 

 

X{n1,}?

 

Minimal match of at least n1 occurrences of X.

X{,n2}?

 

Minimal match of at least zero occurrences but not

 

 

more than n2 occurrences of X.

 

 

 

X{n1,n2}?

 

Minimal match of at least n1 occurrences but not

 

 

more than n2 occurrences of X.

 

 

 

(?!X)

 

Search fails if expression X is matched. The ex-

 

 

pression ^(?!if) matches the beginning of all lines

 

 

that do not start with if.

(X)

 

Matches sub-expression X and specifies a new

 

 

tagged expression (see Using Tagged Search Ex-

 

 

pressions). No more tagged expressions are

 

 

defined once an explicit tagged expression number

 

 

is specified as shown below.

 

 

 

(?dX)

 

Matches sub-expression X and specifies to use

 

 

tagged expression number d where 0<=d<=9. No

 

 

more tagged expressions are defined by the sub-

 

 

expression syntax (X) once this sub-expression

 

 

syntax is used. This is the best way to make sure

 

 

you have enough tagged expressions.

 

 

 

(?:X)

 

Matches sub-expression X but does not define a

 

 

tagged expression.

 

 

 

XY

 

Matches X or Y.

 

 

 

[char-set]

 

Matches any one of the characters specified by

 

 

char-set. A dash (-) character may be used to

 

 

specify ranges. The expression [A-Z]matches any

 

 

uppercase letter. A backslash (\) may be used in-

 

 

side the square brackets to define literal characters

 

 

or define ASCII characters. For example, \- spe-

 

 

cifies a literal dash character. The expression

 

 

[\d0-\d27]matches ASCII character codes 0..27.

 

 

The expression []] matches a right bracket. In

 

 

SlickEdit® regular expressions, [] matches no char-

 

 

acters. In both syntaxes, the expression [\]]

 

 

matches a right bracket. The expression [^]

 

 

matches a caret (^) character but this does not work

 

 

for SlickEdit regular expressions. In both syntaxes,

 

 

[\^] matches a caret (^) character.

 

 

 

521

Page 543
Image 543
Slick V3.3 manual Unix Regular Expression Definition Xn1,?, N2?, Xn1,n2?, ?!X, ?dX