title: java.util.regex - importance of Pattern.compile()?
body: <p>What is the importance of <code>Pattern.compile()</code> method?<br>
  Why do I need to compile the regex string before getting the <code>Matcher</code> object?</p>
  
  <p>For example :</p>
  
  <pre><code>String regex = "((\\S+)\\s*some\\s*";
  
  Pattern pattern = Pattern.compile(regex); // why do I need to compile
  Matcher matcher = pattern.matcher(text);
  </code></pre>