Maybe you use a group here without capture?
Regex.Replace(this.Text, "<font color="#(?:[\\d\\w]{6})">", "<font color=\"#$1\">");
this:
(?:[\\d\\w]{6})
instead
([\\d\\w]{6})
You can use @btw to avoid all special characters: @"(?:[\d\w]{6})"
Also, have you tried
"<font color=\"#" + $1 + "\">"
Otherwise, I do not think C # will know $ 1 from the usual string value
source
share