In Kotlin toRegex is just an extension function that creates a Regex object. On Kotlin/JVM that just calls Pattern. compile(pattern) , so the underlying code comes from the JDK and is thread-safe .
In Kotlin toRegex is just an extension function that creates a Regex object. On Kotlin/JVM that just calls Pattern. compile(pattern) , so the underlying code comes from the JDK and is thread-safe .