fork(1) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String s = "Действующие вещества:</td>\n" +
  11. " <td><a href=\"\" class=\"\">*</a></td>";
  12. Pattern pattern = Pattern.compile("(?s)Действующие вещества:.*?class=\"\">(.*?)</a>");
  13. Matcher matcher = pattern.matcher(s);
  14. while(matcher.find()) {
  15. System.out.println("Действующие вещества: "+ matcher.group(1));
  16. }
  17. }
  18. }
Success #stdin #stdout 0.05s 2184192KB
stdin
Standard input is empty
stdout
Действующие вещества: *