matchesAt

expect fun matchesAt(input: CharSequence, index: Int): Boolean(source)

Checks if a regular expression matches a part of the specified input char sequence exactly at the specified index.

Unlike matches function, it doesn't require the match to span to the end of input.

Since Kotlin

1.7

Throws

if index is less than zero or greater than the length of the input char sequence.

Samples


fun main() { 
   //sampleStart 
   val releaseText = "Kotlin 1.5.30 is released!"
val versionRegex = "\\d[.]\\d[.]\\d+".toRegex()
println(versionRegex.matchesAt(releaseText, 0)) // false
println(versionRegex.matchesAt(releaseText, 7)) // true 
   //sampleEnd
}
actual fun matchesAt(input: CharSequence, index: Int): Boolean(source)

Since Kotlin

1.7
actual fun matchesAt(input: CharSequence, index: Int): Boolean(source)

Since Kotlin

1.7
actual fun matchesAt(input: CharSequence, index: Int): Boolean(source)

Since Kotlin

1.7