I want to add to this rule match on Apostrophe \'
\'
rule = re.compile(r\'^[^*$<,>?!]*$\')
I have tried:>
You have to escape the apostrophe, otherwise it will be counted as the end of the raw string:
rule = re.compile(r'^[^*$<,>?!\']*$')
Or, you can use " to surround your string, which is perfectly valid in python:
"
rule = re.compile(r"^[^*$<,>?!']*$")