How to extract product weight from this HTML

Posted by Blankman on Stack Overflow See other posts from Stack Overflow or by Blankman
Published on 2010-04-27T18:26:33Z Indexed on 2010/04/27 18:33 UTC
Read the original article Hit count: 191

Filed under:
|

My HTML looks like this:

<td class="main"><b>Product Weight  (2.83 lbs in 1 container)</b></td>

I need to get the value 2.83 from the HTML.

Need help with the regex.

I have this:

    Pattern p = Pattern.compile(

  "<td\\sclass=\"main\"><b>Product\\sWeight\\s\\s((?:\\d+\\.)?\\d+ \\w{3})");

But doesn't seem to be working.

Am I missing an escape or something?

© Stack Overflow or respective owner

Related posts about java

Related posts about regex