If I do this:
Regex.Replace("unlocktheinbox.com", "[t]", "\\$&");
My result is:
"unlock\\theinbox.com"
I'm expecting it to be
"unlock\theinbox.com"
I'm trying to replace "t" with "\t" using regex.replace. I made this example very basic to explain what I'm trying to accomplish.
Try following
var result = Regex.Replace("unlocktheinbox.com", "[t]", @"\");
Note that, if you observe result
while debugging via hovering mouse on result
. it will look like unlock\\theinbox.com
because \
is escaped. But actually, if you print result
or use anywhere it will be unlock\theinbox.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With