title: Extract variables from code statement using regex
body: <p>I'm trying to extract variables from code statements and "if" condition. I have a regex to that but <code>mymatcher.find()</code> doesn't return any values matched.
  I don't know what is wrong.</p>
  
  <p>here is my code:</p>
  
  <pre><code>import java.util.regex.Matcher;
  import java.util.regex.Pattern;
  
  public class test {
      public static void main(String[] args) {
          String test="x=y+z/n-10+my5th_integer+201";
          Pattern mypattern = Pattern.compile("^[a-zA-Z_$][a-zA-Z_$0-9]*$");
          Matcher mymatcher = mypattern.matcher(test);    
          while (mymatcher.find()) {
              String find = mymatcher.group(1) ;
              System.out.println("variable:" + find);
          }
      }
  }
  </code></pre>