On 2012-12-08 23:34, Hans Mulder wrote:
On 8/12/12 23:57:48, rh wrote:Not sure if the \w sequence includes the - or the . or the / I think it does not.You guessed right:[ c for c in 'x-./y' if re.match(r'\w', c) ]['x', 'y']So x and y match \w and -, . and / do not.
This is shorter: >>> re.findall(r'\w', 'x-./y') ['x', 'y'] But remember that r"\w" is more than just r"[A-Za-z0-9_]" (unless you're using ASCII). -- http://mail.python.org/mailman/listinfo/python-list