pomsky
pomsky copied to clipboard
Intersection and subtraction of character classes
Intersection
[Numeric] & [Latin]
# [\pN&&\p{Latin}]
[Numeric '_'] & [Latin]
# [[\pN_]&&\p{Latin}]
Pomsky should apply DeMorgan's laws when possible:
![Numeric] & ![Latin]
# is equivalent to
!([Numeric] | [Latin])
# which can be simplified to
![Numeric Latin]
Subtraction
Using a keyword:
[Numeric] without [Latin]
Using an operator:
[Numeric] - [Latin]
Using the - sign here might be confusing if we ever allow character ranges outside of brackets, i.e. 'a'-'z' | '_'.