[Python-de] Index im String suchen

Andreas Jung andreas at andreas-jung.com
Sun Feb 2 14:16:56 EST 2003


--On Sonntag, 2. Februar 2003 13:50 +0100 Albert Hermeling 
<Albert.Hermeling at t-online.de> wrote:

>
> Zu 1. warum kann ich per RegEx die Zeichenkombination <bo> nicht finden,
> ich  habe doch die Spitzenklammern per Backslash geschuetzt?
>

Doku lesen:

"""
Note that match may differ from search using a regular expression beginning 
with "^": "^" matches only at the start of the string, or in MULTILINE mode 
also immediately following a newline. The ``match'' operation succeeds only 
if the pattern matches at the start of the string regardless of mode, or at 
the starting position given by the optional pos argument regardless of 
whether a newline precedes it.
"""

Im Klartext: Nimm re.search() anstatt re.match()

-aj




More information about the Python-de mailing list