SSMS 2016 Regular Expression $ replacement is broken
In the 2016 July/August release of SSMS (13.0.15600.2) the regular anchor tag for end of line, $ matches correctly. The replacement though is not working as expected.
The replacement is happening after the match. $ represents the end of the line and the replacement token should be inserted before the carriage return and/or linefeed. This works correctly with 2012 and 2014 where the replacement occurs before the end line.
Mikael Eriksson has made the excellent observation. This is actually happening after the CR and before the LF characters.
Do you happen to know if visual studio 2013/2015 exhibit the same behavior?
Leigh Waldie commented
This is still broken in SSMS 17.6 - please fix it.
Reproduce this issue like this:
1. Open a new query
2. type two lines of text <- do not press return after the second line.
Ctrl-H, then type $ in the Find box, type * in the Replace box, click the Regular Expression button and then click Replace All button.
This will incorrectly insert a new line between lines 1 and 2 with the first "*" on it, but correctly place a second "*" at the end of the second line.
Now create a new query and type two lines of text