regex question

Mark Peters mpeters42 at gmail.com
Mon Jan 8 09:57:01 CET 2007


> yes, i suppose you are right.  i can't think of a reason i would NEED a
> raw string in this situation.
It looks from your code that you are trying to remove all occurances of
one string from the other.  a simple regex way would be to use re.sub()

>>> import re
>>> a = "abc"
>>> b = "debcabbde"
>>> re.sub("[" + a + "]","",b)
'dede'




More information about the Python-list mailing list