I can do it in sed...

Bengt Richter bokr at oz.net
Thu Mar 17 22:04:37 EST 2005


On Thu, 17 Mar 2005 18:37:11 -0500, Kotlin Sam <xavier_onasis at hotmail.com> wrote:

>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.
>
Bravo. That's the spirit.
For even better appreciation of your future efforts, consider not top-posting ;-)

>Thanks again,
>Lance
>
>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.
>> 
>> Kent
>

Regards,
Bengt Richter



More information about the Python-list mailing list