What is the point behind character class intersections in Java's Regex?
java, regex
Solution
Though I've never had the need to do so, I could imagine a use with pre-defined character classes that aren't proper subsets of each other (thus making the intersection produce something different than the original two character classes). E.g. matching only lower case Latin characters:
[\p{Ll}&&\p{InBasicLatin}]
Problem
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.)