string search and modification

Paul Rubin http
Wed Sep 6 22:23:43 CEST 2006

Jim Britain <nomail2me at> writes:
> I would like to match [] (including the qualifying
> brackets), but be able to simply return the contents, without the
> brackets.

 >>> p=r'\[((\d{1,3}\.){3}\d{1,3})\]'
 >>> m = ' [] (may be'
'' matches the stuff in the first set of parens, which excludes
the square brackets.

More information about the Python-list mailing list