16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

\ This character turns off the special meaning of metacharacters. For<br />

example, \. only matches a dot character. Note that \\ matches a literal \<br />

character. Also note the special case of “\d” described in the following<br />

paragraph.<br />

\d For d representing any single decimal digit (from 1 to 9), this pattern is<br />

equivalent to the string matching the dth expression enclosed within the ()<br />

characters (or \(\) for some commands) found at an earlier point in the<br />

regular expression. Parenthesized expressions are numbered by counting (<br />

characters from the left.<br />

Constructs of this form can be used in the replacement strings of<br />

substitution commands (for example, the sub function of awk), to stand for<br />

constructs matched by parts of the regular expression.<br />

regexp*<br />

A regular expression regexp followed by * matches a string of zero or more<br />

strings that would match regexp. For example, A* matches A, AA, AAA and<br />

so on. It also matches the null string (zero occurrences of A). ).<br />

regexp+<br />

A regular expression regexp followed by + matches a string of one or more<br />

strings that would match regexp.<br />

regexp?<br />

A regular expression regexp followed by ? matches a string of one or zero<br />

occurrences of strings that would match regexp.<br />

char{n} | char\{n\}<br />

In this expression (and the ones to follow), char is a regular expression that<br />

stands for a single character—for example, a literal character or a period<br />

(.). Such a regular expression followed by a number in brace brackets<br />

stands for that number of repetitions of a character. For example, X\{3\}<br />

stands for XXX. In basic regular expressions, in order to reduce the number<br />

of special characters, { and } must be escaped by the \ character to make<br />

them special, as shown in the second form (and the ones to follow).<br />

char{min,} | char\{min,\}<br />

When a number, min, followed by a comma appears in braces following a<br />

single-character regular expression, it stands for at least min repetitions of a<br />

character. For example, X\{3,\} stands for at least three repetitions of X.<br />

char{min,max} | char\{min,max\}<br />

When a single-character regular expression is followed by a pair of<br />

numbers in braces, it stands for at least min repetitions and no more than<br />

max repetitions of a character. For example, X\{3,7\} stands for three to<br />

seven repetitions of X.<br />

regexp1 | regexp2<br />

This expression matches either regular expression regexp1 or regexp2.<br />

(regexp) | \(regexp\)<br />

This lets you group parts of regular expressions. Except where overridden<br />

by parentheses, concatenation has the highest precedence. In basic regular<br />

expressions, in order to reduce the number of special characters, ( and )<br />

must be escaped by the \ character to make them special, as shown in the<br />

second form.<br />

Several regular expressions can be concatenated to form a larger regular<br />

expression.<br />

regexp<br />

Appendix C. Regular Expressions (regexp) 887

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!