Sanity Check on a RE Replace
Posted: Fri Sep 06, 2013 9:52 pm
I'm doing a RE Replace, and here are the results I get.
Scenario #1
Find what: \xFF
Replace with: \
Result: Replaces ÿ with \
Scenario #2
Find what: \xFF
Replace with: \\
Result: Replaces ÿ with \
Scenario #3
Find what: \xFF
Replace with: \\\\
Result: Replaces ÿ with \\
The Replace with value would seem to resolved from RE into a literal if it's a valid RE (Scenarios #2 and #3), but otherwise it's treated as a literal (Scenario #1).
I am guessing it has always been that way, but should it?
Scenario #1
Find what: \xFF
Replace with: \
Result: Replaces ÿ with \
Scenario #2
Find what: \xFF
Replace with: \\
Result: Replaces ÿ with \
Scenario #3
Find what: \xFF
Replace with: \\\\
Result: Replaces ÿ with \\
The Replace with value would seem to resolved from RE into a literal if it's a valid RE (Scenarios #2 and #3), but otherwise it's treated as a literal (Scenario #1).
I am guessing it has always been that way, but should it?