I have a string and a pattern that i want to search for in that string. Now, when i match the pattern in the string, i want to know the string that matches my pattern.
String template = "<P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"12\"> My Name is xyz </FONT></P>";
String pattern = "<FONT.*>";
Pattern.compile(pattern,Pattern.CASE_INSENSITIVE);
How can i find out the string that matches the pattern in my template.
i.e i want to get <FONT FACE=\"Verdana\" SIZE=\"12\">
as the result. Is there any method provided by the regex library in java which can help me?
Update:
What is the regular expression that can match My Name is xyz and