Do you have a comment or suggestion to improve SQL Server? We’d love to hear it!

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.

Attachment isn't working but this is what it looks like in 2016 http://i.stack.imgur.com/2GTBO.gif and this is it working correctly in 2014 http://i.stack.imgur.com/Tisxg.gif

2 votes
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)

We’ll send you updates on this idea

AdminMicrosoft SQL Server (Product Manager, Microsoft Azure) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...
  • Leigh Waldie commented  ·   ·  Flag as inappropriate

    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

Feedback and Knowledge Base