title: Regex to find if a specific character exists odd times in String
body: <p>Is there any way to write a <code>regular expression</code> in Java  which finds if a <code>String</code> contains an odd number of a specific character i.e. <code>"a"</code>? I have done it writing more verbose code, using namely the following method:</p>
  
  <pre><code>public static boolean hasEvenNumber(String s) {
          int count = 0;
  
          Pattern p = Pattern.compile("(^a)*(a)");
          Matcher m = p.matcher(s);
          while (m.find())
              count++;
  
          if (count % 2 != 0)
              return true;
          return false;
      }
  </code></pre>
  
  <p>If for example one passes the String <code>"jsadaajaaikadjasl"</code> as parameter, then it retuns true, since it contains 7 <code>"a"</code>. Is there a more elegant way to achieve it using only a <code>regex</code> and checking it like:</p>
  
  <pre><code>Pattern p = Pattern.compile(...);
  Matcher m = p.matcher(s);
  if(m.matches())
     return true;  
  </code></pre>
  
  <p>?</p>