[issue29388] regex mismatch in the simple cases

2017-01-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: re.match only matches at the start of the string. If you use re.search instead, you will get the results you are expecting. -- nosy: +steven.daprano resolution: -> not a bug stage: -> resolved status: open -> closed _

[issue29388] regex mismatch in the simple cases

2017-01-29 Thread MaxR
New submission from MaxR: When I compile and match, for example: pattern = re.compile(r"""([a-z]|\d)+$ # ends with letter or number only""", re.VERBOSE | re.IGNORECASE) print(re.match(pattern, 'abc')) result is correct: <_sre.SRE_Match object; span=(0, 3), match='abc'> but then