title: Can a regular expression be used for getting a substring?
body: <p>I'm writing some code Java FX code where I evaluate which button is being clicked, so I need to compare the id of the <code>getSource</code> string.</p>
  
  <p>I'm always getting strings like:</p>
  
  <blockquote>
    <p>Button[id=playButton, styleClass=button]<br>
    Button[id=pauseButton, styleClass=button]<br>
    Button[id=stopButton, styleClass=button]<br>
    Button[id=nextButton, styleClass=button] </p>
  </blockquote>
  
  <p>So according to which button is being clicked I perform some statements. I was using a set of <code>if</code> and <code>else if</code>'s evaluating <code>contains(id)</code> where id would play, pause, stop and next. </p>
  
  <p>I'd like it better to use a switch so every case would be play, pause, stop and next. 
  How can I get a subString, getting only any of either play, pause, stop or next?</p>