fork(1) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.util.regex.Matcher;
  4. import java.util.regex.Pattern;
  5.  
  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. String line = "(rate:real;interest,principal:real)";
  14. String pattern = "((?<=[\\(,;])[A-Za-z_]\\w*)";
  15.  
  16. // Create a Pattern object
  17. Pattern r = Pattern.compile(pattern);
  18.  
  19. // Now create matcher object.
  20. Matcher m = r.matcher(line);
  21.  
  22. while (m.find()) {
  23. System.out.println(m.group(1));
  24. }
  25. }
  26. }
Success #stdin #stdout 0.09s 320576KB
stdin
Standard input is empty
stdout
rate
interest
principal