Simple regex that has me banging my head against a wall

Timothy Grant tjg at exceptionalminds.com
Wed Mar 21 17:31:44 EST 2001


Hi again.

I actually thought I had this regex thing down pretty well, but
I'm getting beat up by what I thought should be a simple one.

>>> x = '$1$asdfjke$lkjasdkjfsdasdfj'
>>> re.sub(r'\$', r'\\\$', x)
'\\\\$1\\\\$asdfjke\\\\$lkjasdkjfsdasdfj'

All I want to do is substitute \$ for $.

Thanks.

-- 
Stand Fast,
    tjg.

Timothy Grant                         tjg at exceptionalminds.com
Red Hat Certified Engineer            www.exceptionalminds.com
Avalon Technology Group, Inc.         <><       (503) 246-3630
>>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
>>>>This machine was last rebooted:  64 days  2:43 hours ago<<




More information about the Python-list mailing list