title: get line number within matcher.find() using matcher.start()
body: <p>I am using <code>while(matcher.find())</code> to loop through and retrieve things from a file. I was wondering how would I get a line number from within this loop, if I knew the index of what I have found is at <code>matcher.start()</code>.</p>
  
  <p>I am confused, could someone please explain? </p>
  
  <pre><code> String expr = "&lt;[^&lt;?!&gt;]+&gt;";
       String[] response = new String[5];
  
          Pattern p = Pattern.compile(expr);
          Matcher m = p.matcher(xmlDocument);
          while (m.find()) {
          //  System.out.println(m.group() + " located at " + m.start());
         //   txtMatches.append(m.group() + " located at " + m.start() + "\n");
              if (itemStack.getCount() == 0 &amp;&amp; m.group().contains("&lt;/")) {
                  response[0] = "Orphan closing tag" ; 
                  response[1] = stripUnwantedChars(m.group(), true); 
                  response[2] =  String.valueOf(m.start()); //right here is where i want to return line number
                  return response; 
              }
          //rest of code
  </code></pre>
  
  <p><code>itemStack</code> is a stack of pushed matches and then I am comparing them to see if there is no more items in the stack but there is a match with a closing tag.</p>