fix: invalid regex
This commit is contained in:
parent
152b2c90cf
commit
26bf1d818f
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue