title: Print out the string that matched my regular expression in java?
body: <p><strong>Possible duplicate:</strong> <a href="https://stackoverflow.com/questions/836704/print-regex-matches-in-java">Print regex matches in java</a></p>
  
  <p>I am using Matcher class in java to match a string with a particular regular expression which I converted into a Pattern using the Pattern class. I know my regex works because when I do Matcher.find(), I am getting true values where I am supposed to. But I want to print out the stings that are producing those true values (meaning print out the strings that match my regex) and I don't see a method in the matcher class to achieve that. Please do let me know if anyone has encountered such a problem before. I apologize as this question is fairly rudimentary but I am fairly new to regex and hence am still finding my way around the regex world.</p>