I have taken from this oracle tutorial on java regex, the following bit:
Intersections
To create a single character class matching only the characters common to all of its nested classes, use &&, as in [0-9&&[345]]. This particular intersection creates a single character class matching only the numbers common to both character classes: 3, 4, and 5.
Enter your regex: [0-9&&[345]] Enter input string to search: 3 I found the text "3" starting at index 0 and ending at index 1.
Why would it be useful? I mean if one wants to pattern only 345 why not only [345] instead of "the intersection"?
Thanks in advance.