<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Add text to beginning of line changes the content]]></title><description><![CDATA[<p dir="auto">I am trying to paste in a sql query into notepad++ and it is taking out part of the line.<br />
I have done this previously and it worked so i am doing it correctly.</p>
<p dir="auto">So what i am doing is running a sql querry to get a list of numbers for updates to delete.</p>
<p dir="auto">I paste those into notepad++ and Use ^ to append to the beginning and $ for the end. (using regular expression also).</p>
<p dir="auto">So at the beginning i am trying to add this:<br />
sqlcmd -Snp:\.\pipe\MICROSOFT##WID\tsql\query -Q "EXEC SUSDB.dbo.spDeleteUpdate</p>
<p dir="auto">And what i get is this:<br />
sqlcmd -Snp:.pipeMICROSOFT##WID	sqlquery -Q "EXEC SUSDB.dbo.spDeleteUpdate</p>
<p dir="auto">it takes out the \t and the following \ <br />
so it takes \tsql\query and becomes sqlquery</p>
<p dir="auto">I have tried it with the latest release (64 and 32 bit) and also 7.42 (32 bit)</p>
<p dir="auto">FYI If i paste it one line at a time it works, but with hundreds of lines, well you know!</p>
<p dir="auto">Any help would be appreciated. thanks Tim</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/14708/add-text-to-beginning-of-line-changes-the-content</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Jul 2026 06:09:46 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/14708.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 30 Oct 2017 14:17:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Add text to beginning of line changes the content on Tue, 31 Oct 2017 11:27:07 GMT]]></title><description><![CDATA[<p dir="auto">Slight tweak because <code>\R</code> only works in the <strong>Find-what</strong> zone, so if the intended destination for the escaped text is to be the <strong>Replace-with</strong> zone, the earlier wouldn’t work.</p>
<p dir="auto">Revised <strong>Replace-with</strong> zone: <code>\\(?1\1:r\\n)</code></p>
<p dir="auto">Note that the revision is Windows line-ending (CRLF) specific, but this shouldn’t be much of an issue.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/27751</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/27751</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Tue, 31 Oct 2017 11:27:07 GMT</pubDate></item><item><title><![CDATA[Reply to Add text to beginning of line changes the content on Mon, 30 Oct 2017 19:28:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: Scott-Sumner">@<bdi>Scott-Sumner</bdi></a> said:</p>
<blockquote>
<p dir="auto">leave it selected for copying (well, maybe…on the leave it selected part)</p>
</blockquote>
<p dir="auto">What I meant by the above is that I noticed that if a character that needs to be escaped occurs as the last character in the starting selection, after the macro runs the 2 characters generated for it are omitted from the new selection.  So the selection would have to be lengthened two by 2 characters before copying would be effective.  :(</p>
<p dir="auto">This isn’t a downfall of this technique but rather an apparent bug in Notepad++'s replace-in-selection logic…see <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/issues/2995" rel="nofollow ugc">https://github.com/notepad-plus-plus/notepad-plus-plus/issues/2995</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/27745</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/27745</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Mon, 30 Oct 2017 19:28:56 GMT</pubDate></item><item><title><![CDATA[Reply to Add text to beginning of line changes the content on Mon, 30 Oct 2017 18:43:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tim-perreault" aria-label="Profile: Tim-Perreault">@<bdi>Tim-Perreault</bdi></a></p>
<p dir="auto">If this is something that you do often, you can record a macro to help:</p>
<p dir="auto">So, record this action as a macro and name it “Escape Selection”:</p>
<p dir="auto"><strong>Find what</strong> zone: <code>([][\.^$*+?(){}\\|-])|(\R)</code><br />
<strong>Replace with</strong> zone: <code>\\(?1\1:R)</code><br />
<strong>Search mode</strong> radio-button: <code>Regular expression</code><br />
<strong>In selection</strong> checkbox:  <em><strong>ticked</strong></em></p>
<p dir="auto">To use it, you would highlight the text (which can even span lines) you need to be verbatim (but expressed as a regex!), run the macro, it will change the text as needed, you copy the text to the clipboard and Undo the change.  Then (for your described usage) when you move to the Replace window’s Replace-with zone, you paste in the clipboard contents.  It sounds lengthier when described than it actually is to do it.</p>
<p dir="auto">Thus in your example, you would highlight this text and run the macro:</p>
<pre><code>sqlcmd -Snp:\.\pipe\MICROSOFT##WID\tsql\query -Q "EXEC SUSDB.dbo.spDeleteUpdate
</code></pre>
<p dir="auto">It will change the text to this and leave it selected for copying (well, maybe…on the leave it selected part):</p>
<pre><code>sqlcmd \-Snp:\\\.\\pipe\\MICROSOFT##WID\\tsql\\query \-Q "EXEC SUSDB\.dbo\.spDeleteUpdate
</code></pre>
<p dir="auto">Do an <em><strong>Undo</strong></em> and you are back where you started except you have an escaped string in the clipboard, that you can then do whatever you need with.</p>
<p dir="auto">Hopefully I hit all the characters that need escaping, but if not this is tweakable.  Another improvement might be to add the copy action into the macro at the end and call the macro “Escape Selection and Copy”.</p>
<p dir="auto">[Note that this does require you to have the source text in a Notepad++ editing tab and not merely in a <strong>Find-what</strong> or <strong>Replace-with</strong> zone, but this is often the case…]</p>
]]></description><link>https://community.notepad-plus-plus.org/post/27742</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/27742</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Mon, 30 Oct 2017 18:43:33 GMT</pubDate></item><item><title><![CDATA[Reply to Add text to beginning of line changes the content on Mon, 30 Oct 2017 17:58:19 GMT]]></title><description><![CDATA[<p dir="auto">Thanks that worked.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/27739</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/27739</guid><dc:creator><![CDATA[Tim Perreault]]></dc:creator><pubDate>Mon, 30 Oct 2017 17:58:19 GMT</pubDate></item><item><title><![CDATA[Reply to Add text to beginning of line changes the content on Mon, 30 Oct 2017 15:17:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tim-perreault" aria-label="Profile: Tim-Perreault">@<bdi>Tim-Perreault</bdi></a></p>
<p dir="auto">Since you are using regular expression search mode you have to “escape” the meanings of the special characters regex uses when you want them literally.  Thus for literal <code>\</code> use <code>\\</code>, for literal <code>.</code> use <code>\.</code>, etc.</p>
<p dir="auto">I don’t have quick access to the complete list for Notepad++'s regex engine, but <a href="https://stackoverflow.com/questions/399078/what-special-characters-must-be-escaped-in-regular-expressions" rel="nofollow ugc">this link</a> should cover most if not all of the characters that need this escaping.</p>
<p dir="auto">You are working in the <strong>Replace-with</strong> zone and its requirements for what needs escaping likely vary somewhat from the escaping requirements of the <strong>Find-what</strong> zone, but this should put you on the right track to success. :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/27736</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/27736</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Mon, 30 Oct 2017 15:17:09 GMT</pubDate></item></channel></rss>