2008年6月20日 星期五

regular expression

match
ex:
import re
match= re.match( '/(.*)/(.*)', 'abc/def/' )
match.groups()
---> ( 'abc', 'def' )

^:
match the start of  the string

$:
match the end of the string

{ }:
ex:
\d{1,2}
one or two numbers

沒有留言: