title: Java WildCard replacement
body: <p>I have a text field where a user is required to input information.</p>
  
  <pre><code>JTextField data = new JTextField();
  </code></pre>
  
  <p>I have a requirment that if a user enters in <b>*</b>. Then it should be treated as a regex wildcard for when I search for the data.</p>
  
  <p>I am looping through a series of files and reading each line one by one.</p>
  
  <pre><code>for(int i = 0; i &lt; files.length; i++) {
          BufferedReader reader = null;
  
          try {
              reader = new BufferedReader(new FileReader(files[i]));
              String text = null;
  
              while ((text = reader.readLine()) != null) {
                  if(text.contains(data) return text; // Line that requires wildcard check
              }
          } catch(IOException e) {
              e.printStackTrace();
          } finally{
              try {
                  if (reader != null) {
                      reader.close();
                  }
              } catch (IOException e) {}
          }
      }
  </code></pre>
  
  <p>How could I achieve this wildcard check? I require to make the '*' become any character once entered by user.</p>