What is the equivalent of String.prototype.match() of JS in Kotlin (JVM)


#1

"Posts: 1241".match(/\d+/)[0] // result: 1241

What is the shortest way to do this in Kotlin (JVM)


#2

I figured out by myself, hope it will help someone in future:
Regex("(\\d+)").find(str)?.value