[Python-de] Re: [Python-de] reguläre Ausdrücke
Carsten Tilch
ctilch at gmx.de
Wed Apr 24 11:39:51 EDT 2002
#Hallo Erhan, zum Einsteigen in re fällt mir folgendes ein :
import re
str = '''ich bin text/*bla bla bla
bla bla bla*/ich bin text'''
pattern = re.compile('[/*].*[/*]',re.DOTALL)
match = pattern.search(str)
if match:
print match.group(0)#slice der mit dem muster übereinstimmt
print match.start(0)#beginn des gefundenen musters im string
print match.end(0)#ende des gefundenen musters im string
#Ein gutes HOWTO findest du bei :
#http://py-howto.sourceforge.net/regex/regex.html
Carsten
More information about the Python-de
mailing list