You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking over project regex and I noticed this one. It seems to try to look for punctuation and is trying to use \p{} for unicode but this is not a feature supported in python. It also might be dead code in general.
The text was updated successfully, but these errors were encountered:
$ cat t.py
import re
PUNCTUATION = re.compile("[^\\p{Ll}\\p{Lu}\\p{Lt}\\p{Lo}\\p{Nd}\\p{Pc}\\s]")
print("regex: " + PUNCTUATION.pattern)
forcharin ["a", "p", "!"]:
if PUNCTUATION.search(char):
print("Matches a '{}'".format(char))
else:
print("Does not match a '{}'".format(char))
$ python3 t.py
regex: [^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}\s]
Matches a 'a'
Does not match a 'p'
Matches a '!'
It matches "a" but not "p" because the character class is looking for NOT "p { L l ...".
I was looking over project regex and I noticed this one. It seems to try to look for punctuation and is trying to use \p{} for unicode but this is not a feature supported in python. It also might be dead code in general.
The text was updated successfully, but these errors were encountered: