(H[ae]llo|Hi(ho)?|Mahlzeit) Tom,
Könntest Du bitte nochmal 'was zu \A und \z sagen.
Ist das identisch mit ^ und $?
Manchmal.
\A und \z verankern ein Suchmuster immer jeweils am Anfang und am Ende der gesamten Zeichenkette.
Die Bedeutung von ^ und $ als "Anker" hängt vom Multiline-Modifikator m ab. Der ist mir zu
blöd, wenn ich Zeilenumbrüche erkennen will, verlasse ich mich lieber auf (\r\n|[\r\n]).
bei PHP steht leider nur "The simple assertions coded as \b, \B, \A, \Z, \z, ^ and $ are described above" und above ist (noch) nichts zu finden. Liegt wohl am Umbau der Seiten.
http://de2.php.net/manual/en/regexp.reference.assertions.php
Letztendlich schreibt man dort nur von der offiziellen Dokumentation ab.
Der passende Abschnitt für ^ und $ dürfte der hier sein:
PCRE_MULTILINE
By default, PCRE treats the subject string as consisting of a single
line of characters (even if it actually contains newlines). The "start
of line" metacharacter (^) matches only at the start of the string,
while the "end of line" metacharacter ($) matches only at the end of
the string, or before a terminating newline (unless PCRE_DOLLAR_ENDONLY
is set). This is the same as Perl.When PCRE_MULTILINE it is set, the "start of line" and "end of line"
constructs match immediately following or immediately before internal
newlines in the subject string, respectively, as well as at the very
start and end. This is equivalent to Perl's /m option, and it can be
changed within a pattern by a (?m) option setting. If there are no new-
lines in a subject string, or no occurrences of ^ or $ in a pattern,
setting PCRE_MULTILINE has no effect.
Und Wiki schweigt sich dazu ganz aus.
http://de.wikipedia.org/wiki/Regulärer_Ausdruck
Die Homepage auf pcre.org verweist explizit auf den PCRE-Artikel in der englischprachigen Wikipedia.
Also würde ich lieber da nachschauen.
MffG
EisFuX