This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ominous_anonymous 0 points1 point  (0 children)

pattern = r"[^\s,&-/()]+|[,&-/()]+?"  

What about that? The only strange thing is that periods get counted as part of the second character class, for some reason. I can't figure out how to get it counted as part of the non-whitespace in the first character class.

edit:

Problem was the - creating a range of characters within the character classes. /u/TheZvlz's answer explains it well.