Regular Expression Syntax Help

Ernesto erniedude at gmail.com
Tue Feb 7 10:08:45 EST 2006


I'm trying to get the right syntax for my regular expression.  The
string I'm trying to parse is:

# myString
[USELESS DATA]
Name:  David Dude
[USELESS DATA]

Right now, I'm using the following code:


pattern_Name= '''(?x)
    Title:\s+(\w+)\s+
'''
names = re.findall(pattern_Name, myString)
print names

This prints out a list containing only the first names.  I want to
search the string until it finds a '\n' endline, but I experimented
with that, and couldn't find what I need.




More information about the Python-list mailing list