fork(4) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3.  
  4.  
  5. class rTest {
  6. public static void main (String[] args) {
  7.  
  8. String test = "int measure; \n" +
  9. "void introduce() { \n" +
  10. "while (line != null) { \n" +
  11. "if(measure > 0) { \n" +
  12. "System.out.println(smile); \n" +
  13. "} \n" +
  14. "}";
  15.  
  16. String functions = "(?mi)^(?:(?!(?:catch|if|while|try|return|finally|new|throw)).)*$";
  17. Pattern patternFunctions = Pattern.compile(functions);
  18. Matcher matcherFunctions = patternFunctions.matcher(test);
  19. while(matcherFunctions.find())
  20. System.out.println(matcherFunctions.group());
  21.  
  22. }
  23. }
Success #stdin #stdout 0.07s 380160KB
stdin
Standard input is empty
stdout
int measure; 
void introduce() { 
System.out.println(smile); 
} 
}