title: Wildcard matching in Java
body: <p>I'm writing a simple debugging program that takes as input simple strings that can contain stars to indicate a wildcard match-any</p>
  
  <pre><code>*.wav  // matches &lt;anything&gt;.wav
  (*, a) // matches (&lt;anything&gt;, a)
  </code></pre>
  
  <p>I thought I would simply take that pattern, escape any regular expression special characters in it, then replace any <code>\\*</code> back to <code>.*</code>. And then use a regular expression matcher.</p>
  
  <p>But I can't find any Java function to escape a regular expression. The best match I could find is <code>Pattern.quote</code>, which however just puts <code>\Q</code> and <code>\E</code> at the begin and end of the string. </p>
  
  <p>Is there anything in Java that allows you to simply do that wildcard matching without you having to implement the algorithm from scratch?</p>