fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.util.regex.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. String str = "<tr class=\"tr_standard\"><td>Milk (regular), (1 liter) </td> <td style=\"text-align: right\" class=\"priceValue\"> 2.45&nbsp;TL</td>";
  10. Pattern ptrn = Pattern.compile("(?:class=\"priceValue\">\\s+)(\\d*\\.\\d+)");
  11. Matcher matcher = ptrn.matcher(str);
  12. while (matcher.find()) {
  13. System.out.println(matcher.group(1));
  14. }
  15. }
  16. }
Success #stdin #stdout 0.1s 320512KB
stdin
Standard input is empty
stdout
2.45