Quick experiment:
```
Pattern p = Pattern.compile("^\"(.*)\"$");
System.out.println(p.matcher("foo").replaceAll("$1")); // prints foo
System.out.println(p.matcher("\"foo\"").replaceAll("$1")); // prints foo
```