title: Finding the index of the first match of a regular expression in Java
body: <p>EDIT: I found the answer here. <a href="https://stackoverflow.com/questions/8752215/returning-the-string-found-with-a-regular-expression">Returning the String found with a regular expression</a></p>
  
  <p>Is there a straightforward way to get a list of all the substrings that match a regex within a string?</p>
  
  <p>It should do something like this.</p>
  
  <ul>
  <li>Example string: <code>Google</code></li>
  <li>Example regex: <code>(og.e)</code></li>
  <li>What I want to obtain with this method: <code>ogle</code></li>
  </ul>
  
  <p>Another example.</p>
  
  <ul>
  <li>Example string: <code>Facebook</code></li>
  <li>Example regex: <code>(a.o)</code>
  String I want to obtain with this method: <code>acebo</code></li>
  </ul>
  
  <p>EDIT: I've found something that might be relevant to this question. <a href="http://www.java2s.com/Tutorial/CSharp/0360__Regular-Expression/Matchindexandvalue.htm" rel="nofollow noreferrer">http://www.java2s.com/Tutorial/CSharp/0360__Regular-Expression/Matchindexandvalue.htm</a> I still don't know whether this will do what I want it to do.</p>