Regular Expression Syntax Help
Ernesto
erniedude at gmail.com
Tue Feb 7 15:52:21 EST 2006
So now I need to add the requirement that only "Name:" 's which are
followed by
"Request: Play" or "Request: Next" ANYWHERE between the previous titles
and the new titles. Can I use RE's for that ?
Ernesto wrote:
> 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