fix: invalid regex

This commit is contained in:
oSumAtrIX 2022-07-10 19:50:53 +02:00
parent 152b2c90cf
commit 26bf1d818f

View file

@ -4,7 +4,7 @@ class Template(template: String) {
val result: StringBuilder = StringBuilder(template) val result: StringBuilder = StringBuilder(template)
fun replaceVariable(name: String, value: String) { fun replaceVariable(name: String, value: String) {
val regex = Regex("{{\\s?$name\\s?}}") val regex = Regex("\\{\\{\\s?$name\\s?}}")
val range = regex.find(result)!!.range val range = regex.find(result)!!.range
result.replace(range.first, range.last + 1, value) result.replace(range.first, range.last + 1, value)