[Tutor] Regexp result

Helge Aksdal helge at aksdal.net
Thu Jan 22 14:25:32 EST 2004


* Danny Yoo (Thu, Jan 22, 2004 at 00:21 +0100 GMT):
> ###
> >>> sample_text = "this is a test"
> >>> pattern = re.compile(r"(\w+)\s*(\w+)\s*(\w+)\s*(\w+)")
> >>> pattern.search(sample_text).groups()
> ('this', 'is', 'a', 'test')
> ###
> 
> 
> 
> A.M. Kuchling's Python Regex HOWTO should also help you transition your
> Perl regular expression knowledge into Python:
> 
>     http://www.amk.ca/python/howto/regex/
> 
> 
> 
> I hope this helps!

Thank's both of you!
That was indeed helpful!

-- 
Helge Aksdal



More information about the Tutor mailing list