Android Patterns.WEB_URL 坏了?

dgm*_*ltn 5 regex android

那么,有人可以解释一下我的测试中尾部斜杠发生了什么吗?还是 WEB_URL 模式的错误?

@Test
public void testWebUrl() {
    String url = "http://www.google.com/foo/";
    String test = "A string that fails is this: " + url + " <-- see that?";

    Matcher m = Patterns.WEB_URL.matcher(test);
    while (m.find()) {
        assertTrue(Patterns.WEB_URL.matcher(url).matches());  // PASSES
        assertEquals(m.group(), url);  // FAILS
        // Here, m.group() == "http://www.google.com/foo", without the trailing "/"
    }
}
Run Code Online (Sandbox Code Playgroud)