Regular-Expression: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Zeile 159: | Zeile 159: | ||
! Ausdruck || Bedeutung | ! Ausdruck || Bedeutung | ||
|- | |- | ||
− | | <code> | + | | <code>XY</code> |
− | | | + | | X followed by Y |
|- | |- | ||
− | | <code> | + | | <code>X|Y</code> |
− | | | + | | Either X or Y |
+ | |- | ||
+ | | <code>(X)</code> | ||
+ | | X, as a capturing group | ||
|} | |} | ||
Zeile 171: | Zeile 174: | ||
! Ausdruck || Bedeutung | ! Ausdruck || Bedeutung | ||
|- | |- | ||
− | | <code> | + | | <code>\n</code> |
− | | | + | | Whatever the nth capturing group matched |
− | |||
− | |||
− | |||
|} | |} | ||
Version vom 15. Juni 2008, 07:04 Uhr
Dieser Artikel bedarf einer Überarbeitung. Näheres ist auf der Diskussionsseite angegeben. Hilf bitte mit ihn zu verbessern und entferne anschließend diese Markierung. |
Beschreibung
Reguläre Ausdrücke sind Muster, mit denen man den Aufbau von Zeichenketten beschreibt.
Characters
Ausdruck | Bedeutung |
---|---|
x
|
The character x |
\\
|
The backslash character |
\0n
|
The character with octal value 0n (0 <= n <= 7) |
\0nn
|
The character with octal value 0nn (0 <= n <= 7) |
\0mnn
|
The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7) |
\xhh
|
The character with hexadecimal value 0xhh |
\uhhhh
|
The character with hexadecimal value 0xhhhh |
\t
|
The tab character ('\u0009') |
\n
|
The newline (line feed) character ('\u000A') |
\r
|
The carriage-return character ('\u000D') |
\f
|
The form-feed character ('\u000C') |
\a
|
The alert (bell) character ('\u0007') |
\e
|
The escape character ('\u001B') |
\cx
|
The control character corresponding to x |
Character classes
Ausdruck | Bedeutung |
---|---|
xxx
|
xxx |
xxx
|
xxx |
Predefined character classes
Ausdruck | Bedeutung |
---|---|
xxx
|
xxx |
xxx
|
xxx |
POSIX character classes (US-ASCII only)
Ausdruck | Bedeutung |
---|---|
xxx
|
xxx |
xxx
|
xxx |
Classes for Unicode blocks and categories
Ausdruck | Bedeutung |
---|---|
xxx
|
xxx |
xxx
|
xxx |
Boundary matchers
Ausdruck | Bedeutung |
---|---|
xxx
|
xxx |
xxx
|
xxx |
Greedy quantifiers
Ausdruck | Bedeutung |
---|---|
xxx
|
xxx |
xxx
|
xxx |
Reluctant quantifiers
Ausdruck | Bedeutung |
---|---|
xxx
|
xxx |
xxx
|
xxx |
Possessive quantifiers
Ausdruck | Bedeutung |
---|---|
xxx
|
xxx |
xxx
|
xxx |
Logical operators
Ausdruck | Bedeutung |
---|---|
XY
|
X followed by Y |
Y | Either X or Y |
(X)
|
X, as a capturing group |
Back references
Ausdruck | Bedeutung |
---|---|
\n
|
Whatever the nth capturing group matched |
Quotation
Ausdruck | Bedeutung |
---|---|
\
|
Nothing, but quotes the following character |
\Q
|
Nothing, but quotes all characters until \E |
\E
|
Nothing, but ends quoting started by \Q |
Special constructs (non-capturing)
Ausdruck | Bedeutung |
---|---|
(?:X)
|
X, as a non-capturing group |
(?idmsux-idmsux)
|
Nothing, but turns match flags on - off |
(?idmsux-idmsux:X)
|
X, as a non-capturing group with the given flags on - off |
(?=X)
|
X, via zero-width positive lookahead |
(?!X)
|
X, via zero-width negative lookahead |
(?<=X)
|
X, via zero-width negative lookahead |
(?>X)
|
X, as an independent, non-capturing group |
Embedded flag expressions
Ausdruck | Bedeutung |
---|---|
(?u)
|
Pattern.UNICODE_CASE |
(?s)
|
Pattern.DOTALL |
(?m)
|
Pattern.MULTILINE |
(?i)
|
Pattern.CASE_INSENSITIVE |
(?x)
|
Pattern.COMMENTS |
(?d)
|
Pattern.UNIX_LINES |
---
|
Pattern.CANON_EQ (not available) |