Originally posted by Benjamin Hundley:
The $ is only a meta-character in the context of regular expressions correct? I didn't think that the replacement value was a regular expression.
I tried this with a ^ in place of the $ and it worked fine. I thought ^ was a meta-character too.
(It does work when I put \\ in front of the $ in the replacement value. I'm just not exactly sure why.)
The replacement string is *not* a regular expression. However, it is not just a plain string either. The "$" has a special meaning.
Basically, you can build a replacement string using groups that were captured during the regex match. $0 is group zero, $1 is group one, etc...
Henry