I Have a question about finding html tags using Java and Regex.
I am using the code below to find all the tags in HTML, documentURL is obviously the HTML content.
The find method return true, meaning that it can find something in the HTML but the matches() method always return false and I am completly and utterly puzzled about this.
I refered to Java documentations too but could not find my answer.
What is the correct way of using Matcher ?
Pattern keyLineContents = Pattern.compile("(<.*?>)");
Matcher keyLineMatcher = keyLineContents.matcher(documentURL);
boolean result = keyLineMatcher.find();
boolean matchFound = keyLineMatcher.matches();
Doing something like this throws an exeption:
String abc = keyLineMatcher.group(0);
Thanks.