Hi, 2008/4/30 Raymond <[EMAIL PROTECTED]>: > For some reason I'm unable to grok Python's string.replace() function.
replace() does not work with regular expressions.
> Is there a decent description of string.replace() somewhere?
Use re.sub().
>>> import re
>>> line = "date process text [ip] more text"
>>> re.sub('].*$', '', re.sub('^.*\[', '', line, 1))
'ip'
Lutz
--
http://mail.python.org/mailman/listinfo/python-list
