1

I want find text 'ABCD' in

String text = "<div class=\"aaaa\">1234</div>"
            + "   <li class=\"pcs05\">ABCD</li>";

Pattern p = Pattern.compile("<li class=[^A-Za-z0-9]>(\\S+)</li>");
Matcher m = p.matcher(text);
if(m.find()){
    System.out.println(m.group(1));
}

but it doesn't print anything.

Pshemo
  • 122,468
  • 25
  • 185
  • 269
hoyeonUm
  • 49
  • 7
  • 1
    Mandatory link: http://stackoverflow.com/a/1732454/1393766. Any reason you can't use proper tool (HTML or XML parser like jsoup) for that task? – Pshemo May 25 '16 at 15:59