Jim Britain <[EMAIL PROTECTED]> writes:
> I would like to match [123.123.123.123] (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 = 'dsl-kk-dynamic-013.38.22.125.touchtelindia.net [125.22.38.13] (may be'
 >>> g=re.search(p,m)
 >>> g.group(1)
'125.22.38.13'

g.group(1) matches the stuff in the first set of parens, which excludes
the square brackets.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to