title: Regex java. Why using intersection?
body: <p>I have taken from <a href="http://docs.oracle.com/javase/tutorial/essential/regex/char_classes.html" rel="noreferrer">this</a> oracle tutorial on java regex, the following bit:</p>
  
  <blockquote>
    <p>Intersections</p>
    
    <p>To create a single character class matching only the characters common
    to all of its nested classes, use &amp;&amp;, as in [0-9&amp;&amp;[345]]. This
    particular intersection creates a single character class matching only
    the numbers common to both character classes: 3, 4, and 5.</p>
    
    <p>Enter your regex: [0-9&amp;&amp;[345]] Enter input string to search: 3 I
    found the text "3" starting at index 0 and ending at index 1.</p>
  </blockquote>
  
  <p>Why would it be useful? I mean if one wants to pattern only <strong>345</strong> why not only [<strong>345</strong>] instead of "the intersection"?</p>
  
  <p>Thanks in advance.</p>