Also, I frequently use something like s/^[A-Z]/~&/ to pre-pend a tilde or some other string to the beginning of the matched string. I know how to find the matched string, but I don't know how to change the beginning of it while still keeping the matched part.
Something like re.sub(r'^([A-Z])', r'~\1', target) should do it.
Kent -- http://mail.python.org/mailman/listinfo/python-list