fork(2) download
  1. import java.util.regex.Matcher;
  2. import java.util.regex.Pattern;
  3.  
  4. class Main {
  5. public static void main (String[] args) throws java.lang.Exception {
  6. String s1 = "dev_mount flash /mnt/sdcard auto /devices/virtual/mtd/mtd9/mtdblock9";
  7. String regex = "^[^#]*(mnt/[_a-z]*)";
  8. Pattern pattern = Pattern.compile(regex);
  9. Matcher m = pattern.matcher(s1);
  10. if (m.find()) {
  11. System.out.println(m.group(0));
  12. System.out.println(m.group(1));
  13. }
  14. }
  15. }
Success #stdin #stdout 0.03s 245632KB
stdin
Standard input is empty
stdout
dev_mount flash /mnt/sdcard
mnt/sdcard