Java's Regex.Pattern supports the following character class:
[a-z&&[def]]
which matches "d, e, or f" and is called an intersection.
Functionally this is no different from:
[def]
which is simpler to read and understand in a big RE. So my question is, what use are intersections, other than specifying complete support for CSG-like operations on character classes?
(Please note, I understand the utility of subtractions like [a-z&&[^bc]]
and [a-z&&[^m-p]]
, I am asking specifically about intersections as presented above.)