fork download
  1. import java.util.regex.*;
  2.  
  3. class Main
  4. {
  5. public static void main (String[] args) throws java.lang.Exception
  6. {
  7. String s = " <td class=\"foobar\">\n"
  8. + "\n"
  9. + " <a href=\"http://w...content-available-to-author-only...s.com\">Value</a> </td>\n";
  10. String regex = "<td class=\"foobar\".*?<a.*?>(.*?)</a>.*?</td>";
  11. Pattern p = Pattern.compile(regex, Pattern.DOTALL);
  12. Matcher m = p.matcher(s);
  13. if (m.find()) {
  14. System.out.println("Found a match!\n");
  15. }
  16. }
  17. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
Found a match!