I can do it in sed...
xavier_onasis at hotmail.com
Fri Mar 18 00:37:11 CET 2005
Thanks to everyone who answered my two questions. I have only submitted
questions twice, and on both occasions the solutions were excellent,
and, I'm emarrassed to say, much simpler than I thought they would be.
My next goal is to be able to help someone they way y'all have helped me.
Kent Johnson wrote:
> Kotlin Sam wrote:
>> 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.
More information about the Python-list