fun main() {
val str = "This is a {string} with {multiple} {words} wrapped in curly brackets."
// Define the RegEx pattern
val regex = Regex("\\{([^}]+)\\}")
// Find all matches
val matches = regex.findAll(str).map { it.groupValues[1] }.toList()
println("Matches: $matches")
}
/*
run:
Matches: [string, multiple, words]
*/