0
我寫了一個單元測試來幫助我理解Pattern.quote,對於我的生活無法弄清楚爲什麼這個測試沒有通過。Pattern.quote不按預期工作
@Test
public void testRegexEscape() throws Exception {
String text = "Test";
String patternString = "es";
String quoted = Pattern.quote(patternString);
Pattern pattern = Pattern.compile(quoted);
Matcher matcher = pattern.matcher(text);
assertTrue(matcher.matches());
}