Dave Angel wrote:

One hazard is if the string the user inputs has any regex special characters in it. If it's anything but letters and digits you probably want to escape it before combining it with your \\b strings.

It is best to escape any user-input before passing it to regex regardless. The re.escape function will do the right thing whether the string is all letters and digits or not.

>>> re.escape("dev")
'dev'
>>> re.escape("dev+")
'dev\\+'


--
Steven


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to