fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.util.regex.*;
  5. import java.lang.*;
  6. import java.io.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. // your code goes here
  14. String s = "1\\tI\\t_\\tPRP\\tPRP\\t_\\t2\\tnsubj\\t_\\t_\\n2\\tneed\\t_\\tVB\\tVBP\\t_\\t0\\tnull\\t_\\t_\\n3\\tmore\\t_\\tJJ\\tJJR\\t_\\t4\\tamod\\t_\t_\\n4\\twords\\t_\\tNN\tNNS\t__\n6\\tmarvel\\t_\\tNN\\tNNrance";
  15. Pattern pattern = Pattern.compile("\\\\t([^\\\\]*?)\\\\t_\\\\tNN");
  16. Matcher matcher = pattern.matcher(s);
  17. //System.out.println(s);
  18. while (matcher.find()) {
  19. String result = matcher.group(1);
  20. System.out.println(result);
  21. }
  22. }
  23. }
Success #stdin #stdout 0.1s 320320KB
stdin
Standard input is empty
stdout
words
marvel