XML technologies / Regular expressions / Features and dialects / Common metacharacters

(Excerpt from "Regular expressions" by Jeffrey E. F. Friedl)

The rest of this chapter covers metacharacters and features implemented by various programs; the next table provides an overview. Not every aspect is covered, and none of the programs supports all the listed metacharacters. In a sense, this recaps what we encountered in Introduction to regular expressions and Extended introductory examples, but in a broader context and with the foundations established at the beginning of Features and dialects. Reading it once will suffice for later chapters; you can always return here for details.

Some programming tools implement every imaginable notation; others freely redefine familiar metacharacters. I occasionally comment on particular implementations, but do not explore individual tools deeply here. This section covers common metacharacters, their uses, and important caveats. For anything further, consult the tool’s own documentation.

The table outlines the following sections, with page references for each feature and metacharacter.

 

Table: constructs covered in this section.

Character representation

see Shorthand metacharacters...

Shorthand metacharacters: \n, \t, \a, \b, \e, \f, \r, \v, ...

see Octal escapes...

Octal escapes: \Zahl

see Hexadecimal escapes...

Hexadecimal escapes and Unicode escapes: \xZahl, \x{Zahl}, \uZahl, \UZahl, ...

see Control characters...

Control characters: \cZeichen

Character classes and related constructs

see Ordinary classes...

Ordinary classes: [a-z] and [^a-z]

see Almost any character...

Almost any character: dot

see Exactly one byte...

Exactly one byte: \C

see Unicode sequence...

Unicode sequence for combining characters: \X

see Shorthands...

Character-class shorthands: \w, \d, \s, \W, \D, \S

see Unicode properties...

Unicode properties, scripts, and blocks: \p{Prop}, \P{Prop}

see Set operations...

Set operations on character classes: [[a-z]&&[^aeiou]]

see POSIX bracket expression: character...

POSIX bracket expression: character class: [[:alpha:]]

see POSIX bracket expression: collating...

POSIX bracket expression: collating sequence: [[.span-ll.]]

see POSIX bracket expression: character...

POSIX bracket expression: character equivalence: [[=n=]]

see Emacs syntax classes

Emacs syntax classes

Anchors and other zero-width assertions

see Beginning of line or string...

Beginning of line or string: ^, \A

see End of line or string...

End of line or string: $, \Z, \z

see Start of the next...

Start of the next match or end of the previous one: \G

see Word boundaries...

Word boundaries: \b, \B, \<, \>, ...

see Lookahead...

Lookahead: (?=...), (?!...); lookbehind: (?<=...), (?<!...)

Comments and mode modifiers

see Mode modifiers...

Mode modifiers: (?Modifikator), for example (?i) and (?-i)

see Scoped mode modifiers...

Scoped mode modifiers: (?Modifikator:...), for example (?i:...)

see Comments...

Comments: (?#...) and #...

see Literal text...

Literal text: \Q...\E

Grouping and capturing parentheses, logical and greedy constructs

see Grouping and capturing parentheses...

Grouping and capturing parentheses: (...), \1, \2, ...

see Grouping only...

Grouping-only, noncapturing parentheses: (?:...)

see Named subexpressions...

Named subexpressions: (?<Name>...)

see Atomic groups...

Atomic groups: (?>...)

see Alternation...

Alternation: ...|...|...

see Conditional regular expressions...

Conditional regular expressions: (? if then|else)

see Greedy quantifiers...

Greedy quantifiers: *, +, ?, {min, max}

see Lazy quantifiers...

Lazy quantifiers: *?, +?, ??, {min, max}?

see Possessive quantifiers...

Possessive quantifiers: *+, ++, ?+, {min, max}+

  

  

 

 

 

German edition copyright © 2008 by O’Reilly Verlag GmbH & Co. KG
You may print the online version for private use.
Otherwise, this chapter from "Reguläre Ausdrücke" is subject to the same terms as the bound edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, storage and processing in electronic systems.

O’Reilly Verlag GmbH & Co. KG, Balthasarstr. 81, 50670 Köln

back to top