Promote Regex.matchAt and matchesAt to Stable #KT-51470

This commit is contained in:
Ilya Gorbunov
2022-04-08 07:48:19 +03:00
committed by Space
parent d62b01ef41
commit 4598552e46
6 changed files with 24 additions and 24 deletions
@@ -143,15 +143,15 @@ internal constructor(private val nativePattern: Pattern) : Serializable {
*/
public actual fun matchEntire(input: CharSequence): MatchResult? = nativePattern.matcher(input).matchEntire(input)
@SinceKotlin("1.5")
@ExperimentalStdlibApi
@SinceKotlin("1.7")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun matchAt(input: CharSequence, index: Int): MatchResult? =
nativePattern.matcher(input).useAnchoringBounds(false).useTransparentBounds(true).region(index, input.length).run {
if (lookingAt()) MatcherMatchResult(this, input) else null
}
@SinceKotlin("1.5")
@ExperimentalStdlibApi
@SinceKotlin("1.7")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun matchesAt(input: CharSequence, index: Int): Boolean =
nativePattern.matcher(input).useAnchoringBounds(false).useTransparentBounds(true).region(index, input.length).lookingAt()