title: extract data between two tags but not the tags using java regex
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags">RegEx match open tags except XHTML self-contained tags</a>  </p>
  </blockquote>
  
  
  
  <pre><code> I have this list of 100 names to be extracted that lie in between the tags. I need to extract just the data and not the tags using Java Regular Expressions. 
  </code></pre>
  
  <p>Eg: I need the data <strong>Aaron,Teb, Abacha, Jui, Abashidze, Harry</strong>. All in a new line.</p>
  
  <pre><code>    &lt;a class="listing" href=http://eeee/a/hank_aaron/index.html"&gt;Aaron, Teb&lt;/a&gt;&lt;br&gt;
      &lt;a class="listing" href=http://eeee/t/sani_abacha/index.html"&gt;Abacha, Jui&lt;/a&gt;&lt;br&gt;
      &lt;a class="listing" href=http://eeee/i/aslan_abashidze/index.html"&gt;Abashidze, Harry&lt;/a&gt;&lt;br&gt;
  </code></pre>
  
  <p>I wrote the following code, but it extracts the tags too. Where am i going wrong. How do i replace the tags or Is the Regexp wrong.</p>
  
  <pre><code>public static void main(String[] args) throws Exception {
      URL oracle = new URL("http://eeee/all/people/index.html");
      BufferedReader in = new BufferedReader(new InputStreamReader(oracle.openStream()));
      String input;
      String REGEX = "&lt;a class=\"listing\"[^&gt;]*&gt;";
      while ((input = in.readLine()) != null){
          Pattern p = Pattern.compile(REGEX);
          Matcher m = p.matcher(input);
          while(m.find()) {
              System.out.println(input);
          }
      }
      in.close();
  }   
  </code></pre>