fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.regex.Pattern;
  7. import java.util.regex.Matcher;
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12.  
  13.  
  14.  
  15. public static void main (String[] args) throws java.lang.Exception
  16. {
  17. Pattern TEST_PATTERN = Pattern.compile("namespace=\\[[A-Z_]+]");
  18. String testString = "namespace=[SOCIAL_STREAM_MUTATE] id=[a19]";
  19. Matcher matcher = TEST_PATTERN.matcher(testString);
  20. if(matcher.find()) {
  21.  
  22. System.out.println("Match found " + matcher.group(0) + " " + matcher.start(0) + " " + matcher.end(0));
  23.  
  24. }
  25. // your code goes here
  26. }
  27. }
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
Match found namespace=[SOCIAL_STREAM_MUTATE] 0 32