I'm writing a program in Python that uses regular expressions. I am having trouble because an expression that I think should match a string doesn't do it. This is the python code that reproduces my problem:
regex = re.compile(r"ord(er)? *0?([1-4])", re.I)
m = regex.match("CMord01")
m evaluates to FALSE. I would very much like to find out why. I've checked on http://rubular.com/ and there the expression does match the string as expected. Thank you!
regex.search()instead ofregex.match(). Seesearch() vs. match()in the Python docs..*to your regexp.