How to search a
string in an HTML file using
java? I want to parse the html page.I have written a code to serach but its seraching including html tag.But i want to search only in html body only.
Here is my code:-
public class match {
public static void main(String[] args) throws IOException {
String
pattern = "The String";
Pattern regPat = Pattern.compile(pattern);
Matcher matcher = regPat.matcher("");
BufferedReader reader =
new BufferedReader(new FileReader("D:\\report1.html"));
String line;
int count=0;
while ((line = reader.readLine()) != null) {
matcher.reset(line);
if (matcher.find()) {
System.out.println(line);
}