<How to use back references in kotlin regular expr...
# stackoverflow
u
How to use back references in kotlin regular expressions? I'm trying to use a regular expression with back references in kotlin to replace the placeholders of a String in the following fashion: Source: "This is a %s with %02d whatever" Target: "This is a with whatever" So I'm looking for something like this but with a proper syntax, of course: private fun escapePlaceHolders(text: String): String { return """%([^ ]+?)""".toRegex().replace(text, "") } Obviously this code doesn't even compile, let alone work. The problem is that I...