findAll
Returns a sequence of all occurrences of a regular expression within the input string, beginning at the specified startIndex.
Since Kotlin
1.0Throws
if startIndex is less than zero or greater than the length of the input char sequence.
Samples
fun main() {
//sampleStart
val text = "Hello Alice. Hello Bob. Hello Eve."
val regex = Regex("Hello (.*?)[.]")
val matches = regex.findAll(text)
val names = matches.map { it.groupValues[1] }.joinToString()
println(names) // Alice, Bob, Eve
//sampleEnd
}
Returns a sequence of all occurrences of a regular expression within the input string, beginning at the specified startIndex.
Since Kotlin
1.1Throws
if startIndex is less than zero or greater than the length of the input char sequence.
Samples
fun main() {
//sampleStart
val text = "Hello Alice. Hello Bob. Hello Eve."
val regex = Regex("Hello (.*?)[.]")
val matches = regex.findAll(text)
val names = matches.map { it.groupValues[1] }.joinToString()
println(names) // Alice, Bob, Eve
//sampleEnd
}
Returns a sequence of all occurrences of a regular expression within the input string, beginning at the specified startIndex.
Since Kotlin
1.0Throws
if startIndex is less than zero or greater than the length of the input char sequence.
Samples
fun main() {
//sampleStart
val text = "Hello Alice. Hello Bob. Hello Eve."
val regex = Regex("Hello (.*?)[.]")
val matches = regex.findAll(text)
val names = matches.map { it.groupValues[1] }.joinToString()
println(names) // Alice, Bob, Eve
//sampleEnd
}
Returns a sequence of all occurrences of a regular expression within the input string, beginning at the specified startIndex.
Since Kotlin
1.3Throws
if startIndex is less than zero or greater than the length of the input char sequence.
Samples
fun main() {
//sampleStart
val text = "Hello Alice. Hello Bob. Hello Eve."
val regex = Regex("Hello (.*?)[.]")
val matches = regex.findAll(text)
val names = matches.map { it.groupValues[1] }.joinToString()
println(names) // Alice, Bob, Eve
//sampleEnd
}