public Vector<HtmlLink> grabLinks(final String html){
  final Vector<HtmlLink> result=new Vector<HtmlLink>();
  final Matcher matcherTag=patternTag.matcher(html);
  while (matcherTag.find()) {
    final String href=matcherTag.group(1);
    final String linkText=matcherTag.group(2);
    final Matcher matcherLink=patternLink.matcher(href);
    while (matcherLink.find()) {
      final String link=matcherLink.group(1);
      final HtmlLink obj=new HtmlLink(link,linkText);
      result.add(obj);
    }
  }
  return result;
}

public Vector < HtmlLink > grabLinks ( final String html ) { final Vector < HtmlLink > result = new Vector < HtmlLink > ( ) ; final Matcher matcherTag = patternTag . matcher ( html ) ; while ( matcherTag . find ( ) ) { final String href = matcherTag . group ( 1 ) ; final String linkText = matcherTag . group ( 2 ) ; final Matcher matcherLink = patternLink . matcher ( href ) ; while ( matcherLink . find ( ) ) { final String link = matcherLink . group ( 1 ) ; final HtmlLink obj = new HtmlLink ( link , linkText ) ; result . add ( obj ) ; } } return result ; }
validate html with regular expression
