I'm trying to match against *=, &=, +=, -=, |=, and ^= in a regular expression, but for some reason the below pattern accepts both <= and >=:
modifyPat = re.compile('\s*[&\|\*/%\+-^]*=[^=]*')
I've done some digging, and found that the problem arises due to the inclusion of the ^ character in the pattern. If, for example, I remove the ^ as in the below pattern, I get expected matching behavior, but of course lose the ability match against ^=:
modifyPat = re.compile('\s*[&\|\*/%\+-]*=[^=]*')
What is going on here, and is there any way to include the ^ character in order to match ^= without also matching <= and >= as I'd desire?