fork download
  1. import java.util.*;
  2. import java.util.regex.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String str = "#TEST_ENV_TEST_VAR=\"value\"";
  11. Pattern p = Pattern.compile("#TEST_ENV_([^=]*)=\"?(.*[^\"])\"?");
  12. Matcher matcher = p.matcher(str);
  13. if (matcher.find()) {
  14. String key = matcher.group(2);
  15. System.out.println(key);
  16. }
  17. }
  18. }
Success #stdin #stdout 0.1s 27916KB
stdin
Standard input is empty
stdout
value