pomsky icon indicating copy to clipboard operation
pomsky copied to clipboard

Intersection and subtraction of character classes

Open Aloso opened this issue 3 years ago • 0 comments

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' | '_'.

Aloso avatar Jun 09 '22 14:06 Aloso