title: How to find substrings with a certain pattern within a string in Java
body: <p>I'm using PDFBox to extract the contents of a PDF file. Following which I'll end up with one massive string. </p>
  
  <p>Now, I need to extract all substrings in this string which match the pattern <strong>XX-XXXX</strong>(where the X can be a number or an alphabet) or <strong>XX YYYY</strong> (where X is a alphabet and Y is a number). </p>
  
  <p>I tried ("([A-Z0-9]{2})-([A-Z0-9]{4})") to match the XX - XXXX pattern but it doesn't return me the expected values. </p>