title: Java match regex and extract group oneliner
body: <p>I have a simple regex like </p>
  
  <pre><code>%(\d+)\$@[_a-zA-Z0-9]+@
  </code></pre>
  
  <p>I don't want to write</p>
  
  <pre><code>Matcher m = Pattern.compile(myRegex).matcher(myText);
  if (m.matches())
     // do something with m.group(1);
  </code></pre>
  
  <p>What I would really like to do is to have a one liner like</p>
  
  <pre><code>// do something with
  Pattern.compile(myRegex).matcher(myText).match().group(1);
  </code></pre>
  
  <p>Do you know a good way to do that in Java (I'm using Java 7 but perhaps something changed in 8)?</p>