Very simply, I am trying to replace a string that contains the substring XX.
import re
def replace_bogus(original, replacement):
bogus = re.compile('[.]*[X][X][.]*')
if bogus.match(original) != None:
original = replacement
return original
if __name__ == "__main__":
teststr = replace_bogus('ABXX0123', '')
print teststr
This code prints out ABXX0123. Why is this regex wrong and what should I use instead?
remodule have it's ownsubmethod for replacing.