老师你好,我有个问题:findAll().asInterable().map{matchResult},这里都能理解,但是这个groupValues[1],groupValues[3]就是key, url这是怎么看出来的
fun main(args: Array<String>) {
val URL_PATTERN = """(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"""
val link = "<https://api.github.com/user/9794076/repos?type=all&page=2&per_page=20>; rel=\"next\", <https://api.github.com/user/9794076/repos?type=all&page=11&per_page=20>; rel=\"last\""
Regex("""<(${URL_PATTERN})>; rel="(\w+)"""").findAll(link).asIterable()
.map {
val url = it.groupValues[1]
val key = it.groupValues[3]
println("key:$key")
println("url:$url")
it.groupValues.map { value ->
println(value)
}
}
}