(refs #715)Escape $ in replacement string

This commit is contained in:
Naoki Takezoe
2015-04-22 01:20:11 +09:00
parent 43b7f83082
commit 8590c693b9

View File

@@ -148,7 +148,7 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
import scala.util.matching.Regex._
implicit class RegexReplaceString(s: String) {
def replaceAll(pattern: String, replacer: (Match) => String): String = {
pattern.r.replaceAllIn(s, replacer)
pattern.r.replaceAllIn(s, (m: Match) => replacer(m).replace("$", "\\$"))
}
}