Saturday, 15 February 2014

regex - Why Python's re module escapes semicolon characters -



regex - Why Python's re module escapes semicolon characters -

why python's re module escapes semicolon characters?

print(re.escape('text;text'))

gives me next output:

text\;text

>>> re.escape.__doc__ 'escape non-alphanumeric characters in pattern.'

it escapes ;(semicolon), because ; not alphanumeric character.

python regex python-2.7

No comments:

Post a Comment