I've been trying to use regex in python to match either individual punctuation marks or groups of them. For example, I want to split out punctuation marks like '!?!' and just '@'.
I have the following regex: (["#$%&()*+,-/:;<=>@[\]^_`{|}~]|[.?!]+), which does what I want, mostly, except that it seems to capture periods individually (so I get . . . instead of ...)
What I don't understand is that if I move the , character in the first [] group somewhere else, it works fine... even if its just one character right or left.
Is there some significance there? Why doesn't it work properly when I have it where it is? (taken from string.punctuation)
Thanks in advance. I've searched around and couldn't find anything... so hopefully this isn't too dumb of a question...