A
Alphamacaroon
I am noticing some really strange behavior with Regex replacements and
am wondering if anyone can help me make any sense of it.
Let's say we have a string "Price=#InsertPrice#" and we want to
replace "#InsertPrice# with one or more "$" symbols to denote the
price level.
Now, here's what I'm seeing when I try the following replacement
strings:
Replacement String Output
---------------------------------------------------------------------------------------
"$" -> "Price=
$"
"$$" -> "Price=
$"
"$$$" -> "Price=$
$"
What appears to be happening is that it's truncating the first "$"
when the output string is being built.
My first thought is that this might be because the "$" symbol is a
special character used for substitutions and I needed to escape it.
But when I try to escape it, it doesn't work either. I get:
@"\$\$" -> "Price=\$\
$"
At this point I have no idea what is going on here and all I can think
of is that this must be a bug. Any ideas?
am wondering if anyone can help me make any sense of it.
Let's say we have a string "Price=#InsertPrice#" and we want to
replace "#InsertPrice# with one or more "$" symbols to denote the
price level.
Now, here's what I'm seeing when I try the following replacement
strings:
Replacement String Output
---------------------------------------------------------------------------------------
"$" -> "Price=
$"
"$$" -> "Price=
$"
"$$$" -> "Price=$
$"
What appears to be happening is that it's truncating the first "$"
when the output string is being built.
My first thought is that this might be because the "$" symbol is a
special character used for substitutions and I needed to escape it.
But when I try to escape it, it doesn't work either. I get:
@"\$\$" -> "Price=\$\
$"
At this point I have no idea what is going on here and all I can think
of is that this must be a bug. Any ideas?