I have written a regex for extracting HTML a tag which has a class with name “c”.
My regex expression is:
<div class=\"c\"(.*?)\<\/div\>
I have a huge HTML but the div which I want to extract is:
<div class="c">
<a name="Adil Arif Bawany" href="/adil.arif.bawany?refid=5">
</a>
</br>
<a href="tel:3222054008">Call</a>
</div>
This should work but but when I find out if there are any matches then boolean gives me false.
My code is:
String matchpa = "<div class=\\\"c\\\"(.*?)\\<\\/div\\>";
Pattern patt = Pattern.compile(matchpa);
Matcher m = patt.matcher(html);
boolean matchFound = m.matches();
Try with this:
It seems to match.
By the way, this tool is very useful when dealing with reg exp.
Hope it helps
Jokahero