fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.Matcher;
  5. import java.util.regex.Pattern;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. final String text = "a,b,c,test1=0 test2=1 test3=2 test4=3 t Request=4,test6_r_a=5,d,e,f";
  13. final Pattern pattern = Pattern.compile("\\w+(?:\\h+\\w+)*=\\w+");
  14. final Matcher matcher = pattern.matcher(text);
  15. while (matcher.find()) {
  16. System.out.println(matcher.group());
  17. }
  18. }
  19. }
Success #stdin #stdout 0.07s 48248KB
stdin
Standard input is empty
stdout
test1=0
test2=1
test3=2
test4=3
t Request=4
test6_r_a=5