
I would like to need the java code for extracting html tags.

Here is a java example that extract a tag from a line of HTML using the Pattern and Matcher classes.
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ExtractContentFromHTMLTag
{
public static void main(String[] args)
{
String stringToSearch = "<p>Hello <h1>Welcome To Roseindia</h1> ...</p>";
Pattern p = Pattern.compile("<h1>(\\S+)</h1>");
Matcher m = p.matcher(stringToSearch);
if (m.find()){
String codeGroup = m.group(1);
System.out.format("'%s'\n", codeGroup);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.