<?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[Regex: Double your words]]></title><description><![CDATA[<p dir="auto">hello. Maybe someone will expand my idea into Increment regex:</p>
<p dir="auto">Search: <code>^(.*)$</code>  or  <code>^(.+)$</code><br />
Replace by: <code>\1 \1</code> or <code>\1 $1</code></p>
<p dir="auto">This will double your words from all lines. But, instead of double, maybe guy38 will be able to expand this to Increment regex.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/12341/regex-double-your-words</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 06:23:03 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/12341.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 08 Sep 2016 17:18:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Regex: Double your words on Wed, 14 Sep 2016 20:10:15 GMT]]></title><description><![CDATA[<p dir="auto">Hello <strong>Glenn</strong>,</p>
<p dir="auto">Oh yes, <strong>Glenn</strong> you’re <strong>thousand</strong> times <strong>right</strong> ! I should have <strong>re-read</strong> my reply, before posting ! Sorry, for being <strong>approximative</strong> !</p>
<p dir="auto">So, given the S/R, below :</p>
<p dir="auto">SEARCH : <strong><code>(?-s)(?:.*\R){26}\K.*(?s)(.*)</code></strong></p>
<p dir="auto">REPLACE : <strong><code>String replacing line 27\1</code></strong></p>
<p dir="auto"><strong>Updated Notes</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong>in-line</strong> modifier <strong><code>(?-s)</code></strong> forces the regex engine to consider that the <strong><code>dot</code></strong> <strong>meta</strong>-character will match <strong>standard</strong> characters, <strong>only</strong></p>
</li>
<li>
<p dir="auto">The <strong>non-capturing</strong> group, repeated <strong>26</strong> times, <strong><code>(?:.*\R){26}</code></strong> selects the <strong>first 26th</strong> <strong>complete</strong> lines, with their <strong>EOL</strong> characters, of each file</p>
</li>
<li>
<p dir="auto">The <strong><code>\K</code></strong> syntax suppresses that <strong>selection</strong> and <strong>reset</strong> the regex position of search between the <strong>last EOL</strong> character of <strong>line 26</strong> and the <strong>first</strong> character of <strong>line 27</strong></p>
</li>
<li>
<p dir="auto">Then the <strong><code> .*</code></strong> part, look for all the <strong>standard</strong> characters, even <strong>0</strong>, of the <strong>27th</strong> line, which have to be <strong>replaced</strong></p>
</li>
<li>
<p dir="auto">Then, the <strong>in-line</strong> modifier <strong><code>(?s)</code></strong>, now, forces the regex engine to consider that the <strong><code>dot</code></strong> <strong>meta</strong>-character will match <strong>any</strong> character ( <strong>standard</strong> OR <strong>End Of Line</strong> character )</p>
</li>
<li>
<p dir="auto">So, the <strong>final</strong> part, <strong><code>(.*)</code></strong>, inside <strong>round</strong> parentheses, defines the <strong>group 1</strong>, containing all the text, from the <strong>EOL</strong> characters of line <strong>27</strong> … to the <strong>very end</strong> of the file</p>
</li>
<li>
<p dir="auto">In replacement, the expression <strong>String replacing line 27</strong> represents, the <strong>new replacement</strong> text and the <strong><code>\1</code></strong> syntax represents the text from the <strong>EOL</strong> characters of line <strong>27</strong> … to the <strong>very end</strong> of the file, which must be re-written <strong>without</strong> any change !</p>
</li>
</ul>
<p dir="auto">With that work-around, <strong>glennfromiowa</strong>, I don’t need to write <strong><code>\r\n</code></strong>, in the <strong>replacement</strong> regex, for the <strong>EOL</strong> characters of the line <strong>27</strong> !!</p>
<p dir="auto">Many thanks again, for pointing out these <strong>approximations</strong> ! Indeed, from now on, I’ll  have to be <strong>careful</strong>, because some people, like you, read my posts, <strong>word</strong> after <strong>word</strong> :-))</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">As I’m a <strong>moderator</strong> of the <strong>Node BB Notepad++</strong> forum, I’m going to <strong>update</strong> my <strong>previous</strong> post, about that topic , by adding a link to that <strong>present</strong> post ! So, anyone will, <strong>easily</strong>, see the <strong>differences</strong> :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/17915</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17915</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 14 Sep 2016 20:10:15 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Double your words on Wed, 14 Sep 2016 19:16:22 GMT]]></title><description><![CDATA[<p dir="auto">Hello guy038,</p>
<p dir="auto">First, let me say that I have learned <strong>more</strong> reading a couple of your posts here than I have learned in months of scouring <strong>N++ Help</strong> and other tutorials and experimenting with regex combinations as I’ve tried to move to the next level of understanding regex expressions beyond the basic ones. It’s always so frustrating when you try something that <strong>seems</strong> like it <strong>should</strong> work according to the documentation, but it doesn’t. And it’s hard to find tutorials that use <strong>real-world examples</strong> that I could modify for the problems <strong>I’m</strong> trying to solve.</p>
<p dir="auto">But as I’m trying to understand your post above where you speak about the <strong>N++ Boost</strong> regex engine, in the  <strong>Notes :</strong> section, you mention:</p>
<blockquote>
<ul>
<li>
<p dir="auto">So, the <strong>final</strong> part, <strong><code>(.*)</code></strong>, inside <strong>round</strong> parentheses, define the <strong>group 1</strong>, containing all the text from the <strong>first</strong> character of <strong>line 28</strong> to the <strong>very end</strong> of the file</p>
</li>
<li>
<p dir="auto">In replacement, the expression <strong>String replacing line 27</strong> represents, the <strong>new replacement</strong> text and the <strong><code>\1</code></strong> is the text from <strong>line 28</strong> to the <strong>end</strong> of the file, which must be re-written <strong>without</strong> any change !</p>
</li>
</ul>
</blockquote>
<p dir="auto">Technically, wouldn’t that be more accurately stated like this?</p>
<blockquote>
<p dir="auto">…containing all the text from the <em><strong>last</strong></em> character of <strong>line <em>27 preceding the line break</em></strong> to the <strong>very end</strong> of the file</p>
</blockquote>
<p dir="auto">and</p>
<blockquote>
<p dir="auto">… and the <strong><code>\1</code></strong> is the text from <strong><em>the line break at the end of</em>  line <em>27</em></strong> to the <strong>end</strong> of the file, which must be re-written <strong>without</strong> any change !</p>
</blockquote>
<p dir="auto">I’m not trying to point out errors; just trying to make sure I’m understanding it. Because I understand in the section earlier where you say this:</p>
<blockquote>
<ul>
<li>The <code>\K</code> syntax suppresses that <strong>selection</strong> and <strong>reset</strong> the regex position of search between the <strong>last</strong> character of <strong>line 26</strong> and the <strong>first</strong> character of <strong>line 27</strong></li>
</ul>
</blockquote>
<p dir="auto">It makes sense <strong>then</strong> that the position of the regex cursor is actually <strong>after</strong> the line break, <strong>between</strong> the two lines. However, since the <code>.*</code> part does <strong>not</strong> include an <strong>EOL</strong> pattern <code>\R</code>, the <strong>regex cursor</strong> after that part should be at the <strong>end</strong> of <strong>line 27</strong>, and <strong>not</strong> pick up the <strong>EOL</strong> at the end of <strong>line 27</strong> until <strong>after</strong> the <code>(?s)</code> modifier, correct?</p>
<p dir="auto">Thank you for your helpful posts!</p>
<p dir="auto">Glenn</p>
]]></description><link>https://community.notepad-plus-plus.org/post/17912</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17912</guid><dc:creator><![CDATA[glennfromiowa]]></dc:creator><pubDate>Wed, 14 Sep 2016 19:16:22 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Double your words on Mon, 12 Sep 2016 16:50:31 GMT]]></title><description><![CDATA[<p dir="auto">And If I want to double all my text</p>
<p dir="auto">Search<br />
<code>^(?s)((^.*)()|(.*$))</code><br />
Replace By<br />
<code>$1$2</code>   or if need to insert 2 line between basic text and the double  <code>$1\r\r$2</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/17857</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17857</guid><dc:creator><![CDATA[Vasile Caraus]]></dc:creator><pubDate>Mon, 12 Sep 2016 16:50:31 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Double your words on Sat, 10 Sep 2016 17:18:07 GMT]]></title><description><![CDATA[<p dir="auto">SUPER ! WORKS !</p>
<p dir="auto">thank you guy038  !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/17836</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17836</guid><dc:creator><![CDATA[Vasile Caraus]]></dc:creator><pubDate>Sat, 10 Sep 2016 17:18:07 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Double your words on Wed, 14 Sep 2016 20:19:54 GMT]]></title><description><![CDATA[<p dir="auto">Hello <strong>Vasile Caraus</strong>,</p>
<p dir="auto">Yes, you’re <strong>right</strong> about that issue. It’s just because the <strong>N++ Boost</strong> regex engine, does <strong>NOT</strong> handle <strong>backward</strong> assertions <strong>properly</strong> ! It’s the case, for instance, for the syntaxes <strong><code>\A</code></strong>, <strong><code>\b</code></strong>, <strong><code>\B</code></strong>, as well as some <strong>lookbehinds</strong> syntaxes :-((</p>
<p dir="auto">You can have a <strong>best</strong> implementation of the <strong>Boost</strong> regex library, in <strong>Notepad</strong>, downloading the <strong>Francois-R Boyer</strong> version, from the link, below. Just have a look to the <strong>final</strong> part of my post, with the explanations about the <strong>François-R Boyer’s SciLexer.dll</strong></p>
<p dir="auto"><a href="https://notepad-plus-plus.org/community/topic/9703/is-it-planned-to-switch-to-pcre2/10" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/9703/is-it-planned-to-switch-to-pcre2/10</a></p>
<p dir="auto">I, also, explained all the <strong>technical</strong> advantages of the <strong>François-R Boyer</strong> version.</p>
<p dir="auto"><strong>Unfortunately</strong>, that excellent implementation :</p>
<ul>
<li>
<p dir="auto">Is <strong>still</strong> based on Scintilla <strong>v2.2.7</strong> version</p>
</li>
<li>
<p dir="auto">Does <strong>NOT</strong> work on N++ versions, <strong>posterior to v6.9</strong></p>
</li>
</ul>
<p dir="auto">I know : It’s a pity :-((</p>
<hr />
<p dir="auto">So, we need a work-around to <strong>select</strong> and <strong>replace</strong>, ONLY, the <strong>27th</strong> line of any file, concerned by the the <strong>S/R</strong>. So we going to <strong>cheat</strong> a bit ! To prevent the regex engine for searching something else ( lines <strong>52</strong>, <strong>78</strong>… ), we, simply, need a regex that :</p>
<ul>
<li>
<p dir="auto">Changes <strong>all</strong> the contents of the <strong>line 27</strong> by the <strong>replacement</strong> regex</p>
</li>
<li>
<p dir="auto"><strong>Re</strong>-writes <strong>all</strong> the contents of the file, from <strong>line 28</strong> to the <strong>very end</strong>, <strong>after</strong> the replacement regex of <strong>line 27</strong></p>
</li>
</ul>
<p dir="auto">By this means, the cursor will be, <strong>automatically</strong>, located at the <strong>end</strong> of each file, <strong>after</strong> replacement !</p>
<p dir="auto">So, this leads to the following S/R :</p>
<p dir="auto">SEARCH : <strong><code>(?-s)(?:.*\R){26}\K.*(?s)(.*)</code></strong></p>
<p dir="auto">REPLACE : <strong><code>String replacing line 27\1</code></strong></p>
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li><strong>Preferably</strong>, refer to the link, below, to get the <strong>updated</strong> notes, about that <strong>S/R</strong> ( Many thanks to <strong>Glen</strong>  for his <strong>valuable</strong> re-read !)</li>
</ul>
<p dir="auto"><a href="https://notepad-plus-plus.org/community/topic/12341/regex-double-your-words/13" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/12341/regex-double-your-words/13</a></p>
<ul>
<li>
<p dir="auto">The <strong>in-line</strong> modifier <strong><code>(?-s)</code></strong> forces the regex engine to consider that the <strong><code>dot</code></strong> <strong>meta</strong>-character will match <strong>standard</strong> characters, <strong>only</strong></p>
</li>
<li>
<p dir="auto">The <strong>non-capturing</strong> group, repeated <strong>26</strong> times, <strong><code>(?:.*\R){26}</code></strong> selects the <strong>first 26th</strong> complete lines, of each file</p>
</li>
<li>
<p dir="auto">The <strong><code>\K</code></strong> syntax suppresses that <strong>selection</strong> and <strong>reset</strong> the regex position of search between the <strong>last</strong> character of <strong>line 26</strong> and the <strong>first</strong> character of <strong>line 27</strong></p>
</li>
<li>
<p dir="auto">Then the <strong><code> .*</code></strong> part, look for all the <strong>standard</strong> characters, even <strong>0</strong>, of the <strong>27th</strong> line, which have to be <strong>replaced</strong></p>
</li>
<li>
<p dir="auto">The <strong>in-line</strong> modifier <strong><code>(?s)</code></strong>, now, forces the regex engine to consider that the <strong><code>dot</code></strong> <strong>meta</strong>-character will match <strong>any</strong> character, <strong>standard</strong> OR <strong>End Of Line</strong> character</p>
</li>
<li>
<p dir="auto">So, the <strong>final</strong> part, <strong><code>(.*)</code></strong>, inside <strong>round</strong> parentheses, define the <strong>group 1</strong>, containing all the text from the <strong>first</strong> character of <strong>line 28</strong> to the <strong>very end</strong> of the file</p>
</li>
<li>
<p dir="auto">In replacement, the expression <strong>String replacing line 27</strong> represents, the <strong>new replacement</strong> text and the <strong><code>\1</code></strong> is the text from <strong>line 28</strong> to the <strong>end</strong> of the file, which must be re-written <strong>without</strong> any change !</p>
</li>
</ul>
<p dir="auto">Et voilà !</p>
<p dir="auto"><strong>Vasile Caraus</strong>, this S/R should work on <strong>multiple</strong> files in the <strong>find in Files</strong> dialog :-))</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>IMPORTANT</strong> :</p>
<p dir="auto">If you perform this S/R on a <strong>few</strong> files, using the <strong>Replace</strong> dialog ( <strong>CTRL + H</strong> ), just remember these <strong>two</strong> rules :</p>
<ul>
<li>
<p dir="auto">Firstly, go to the <strong>very beginning</strong> of the current file ( <strong>CTRL + Origin</strong> )</p>
</li>
<li>
<p dir="auto">Secondly use, <strong>exclusively</strong>, the <strong>Replace All</strong> button ( Due to the <strong><code>\K</code></strong> syntax, the <strong>step by step</strong> replacement, with the <strong>Replace</strong> button, does <strong>NOT</strong> work ! )</p>
</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/17834</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17834</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 14 Sep 2016 20:19:54 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Double your words on Sat, 10 Sep 2016 04:10:21 GMT]]></title><description><![CDATA[<p dir="auto">If I want to replace one single line in many files, the only problem is that <code>(?m)(.*\R){26}\K.*\R</code> will find multiple of 26, like 52, 78…etc and will replace all. And not unique line 26.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/17823</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17823</guid><dc:creator><![CDATA[Vasile Caraus]]></dc:creator><pubDate>Sat, 10 Sep 2016 04:10:21 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Double your words on Sat, 10 Sep 2016 12:40:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <strong>Scott</strong>, <strong>MAPJe71</strong> and <strong>All</strong>,</p>
<p dir="auto">I would like to point out that the <strong>n-line</strong> modifier ( either <strong><code>(?m)</code></strong> or <strong><code>(?-m)</code></strong> ) are <strong>quite useless</strong>, if your regex does <strong>NOT</strong> have any <strong><code>^</code></strong> and <strong><code>$</code></strong> anchors ! Indeed :</p>
<ul>
<li>
<p dir="auto">The syntax <strong><code>(?m)</code></strong> ( = <strong>Multi-Lines</strong> ) means that :</p>
<ul>
<li>
<p dir="auto">The <strong><code>^</code></strong> anchor represents the location just before the <strong>first standard</strong> character of <strong>any</strong> line, included the <strong>first</strong> line</p>
</li>
<li>
<p dir="auto">The <strong><code>$</code></strong> anchor represents the location just after the <strong>last standard</strong> character of <strong>any</strong> line, included the <strong>last</strong> line</p>
</li>
</ul>
</li>
<li>
<p dir="auto">The syntax <strong><code>(?-m)</code></strong> ( = <strong>No Multi- lines</strong> =&gt; <strong>Mono -line</strong> ) means that :</p>
<ul>
<li>
<p dir="auto">The <strong><code>^</code></strong> anchor represents the location just before the <strong>very first standard</strong> character of the <strong>first</strong> line, only</p>
</li>
<li>
<p dir="auto">The <strong><code>$</code></strong> anchor represents the location just after the <strong>very last standard</strong> character of the <strong>last</strong> line, only</p>
</li>
</ul>
</li>
</ul>
<p dir="auto"><strong>Note</strong> :</p>
<p dir="auto">Notepad++'s regex engine considers that the <strong><code>(?m)</code></strong> modifier is set, by <strong>default</strong>. So, just use the <strong><code>(?-m)</code></strong> modifier, if necessary !</p>
<hr />
<p dir="auto"><strong>Remark</strong> :</p>
<p dir="auto">Let’s suppose that the <strong>. matches newline</strong> option is <strong>UN</strong>checked, and that your moved back to the <strong>very beginning</strong> of your file. Then :</p>
<ul>
<li>The regex <strong><code>(?-m)^.+$</code></strong> means that you’re trying to search for any <strong>non-empty</strong> range of <strong>standard</strong> characters, between the <strong>very first</strong> character and the <strong>very last</strong> character of the current file. As the dot stands for <strong>standard</strong> characters, only, no text can be <strong>anchored</strong>, at the same time, to these two boundaries ! The <strong>sole</strong> case, where the regex <strong><code>(?-m)^.*$</code></strong> may match something is when your file contains just <strong>ONE</strong> line, with <strong>NO</strong> end of line character, at its end !</li>
</ul>
<p dir="auto">On the contrary :</p>
<ul>
<li>
<p dir="auto">The regex <strong><code>(?s-m)^.+$</code></strong> means that you’re trying to search for any <strong>non-empty</strong> range of <strong>any kind</strong> of characters between the <strong>very first</strong> character and the <strong>very last</strong> character of the current file. So, even if your file contains <strong>several</strong> lines an/or if the <strong>last</strong> line is followed by EOL character(s), this regex will <strong>always</strong> catch all the contents of the file, as the <strong>CTRL + A</strong> shortcut would do :-)</p>
</li>
<li>
<p dir="auto">The regex <strong><code>(?-m)^.+</code></strong> matches the contents of the <strong>first</strong> line of the current file, only</p>
</li>
<li>
<p dir="auto">The regex <strong><code>(?-m).+$</code></strong> matches the contents of the <strong>last</strong> line of the current file, only, if this line does <strong>NOT</strong> end with an <strong>EOL</strong> character</p>
</li>
</ul>
<p dir="auto">Note that the <strong>similar</strong> regexes <strong><code>(?-m)^.*</code></strong> and <strong><code>(?-m).*$</code></strong> products strange additional results !?</p>
<hr />
<p dir="auto">So, <strong>Scott</strong>, when you speak about the regex <strong><code>(?m)(.*\R){26}\K.*\R</code></strong>, as this regex does <strong>NOT</strong> contain any <strong><code>^</code></strong> nor <strong><code>$</code></strong> <strong>anchor</strong>, it just as if you would speak about the regex</p>
<p dir="auto"><strong><code>(.*\R){26}\K.*\R</code></strong></p>
<p dir="auto">Now, if you have <strong>. matches newline</strong> option <strong>UN</strong>checked ( <strong>Case 1</strong> ), the above regex, <strong>correctly</strong>, find the contents of the <strong>27th</strong> line, as any sub-regex <strong><code>.*/R</code></strong> represents the contents of <strong>ONE</strong> line, only !</p>
<p dir="auto">On the contrary, if the <strong>. matches newline</strong> option is <strong>CHECKED</strong> ( <strong>Case 2</strong> ), the simple regex <strong><code>.*\R</code></strong> represents <strong>all</strong> the contents of the current file, till the <strong>last EOL</strong> character. So, after a long enough <strong>backtracking</strong> action, to get <strong>26 complete</strong> lines , in order to match the regex <strong><code>(.*\R){26}</code></strong>, the regex engine, as <strong>MAPje71</strong> said, <strong>forgets</strong> this match, due to the <strong><code>\K</code></strong> form. Therefore, the cursor location is, still, located at the <strong>very first</strong> character of the file. Finally, the last part <strong><code>.*\R</code></strong> catches, again, <strong>all</strong> the contents of the file, till the <strong>last EOL</strong> character of the file</p>
<p dir="auto">Again, you’ll notice that these <strong>two</strong> behaviours, are not related, at all, with the <strong><code>(?m)</code></strong> or <strong><code>(?-m)</code></strong> modifiers !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/17816</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17816</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 10 Sep 2016 12:40:01 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Double your words on Fri, 09 Sep 2016 19:39:55 GMT]]></title><description><![CDATA[<p dir="auto"><code>(?m-s)</code> is equal to <code>(?-s)</code> when the source code has the <code>m</code>-flag enabled by default.</p>
<p dir="auto">With <code>. matches newline</code> checked the source code adds the <code>s</code>-flag which results in the equivalent search expression <code>(?ms)(.*\R){26}\K.*\R</code> (<strong>note</strong> the <strong>missing hyphen</strong> between <code>m</code> and <code>s</code>). <code>.*\R</code> is greedy and matches the complete file, <code>\K</code> discards that match but the second <code>.*\R</code> again matches the complete file.</p>
<p dir="auto">For case 2 (<code>. matches newline</code> checked) change both <code>.*</code> in the expression to non-greedy i.e. <code>(?m)(.*?\R){26}\K.*?\R</code> to get the same result as case 1 (line 27 selected).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/17808</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17808</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Fri, 09 Sep 2016 19:39:55 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Double your words on Fri, 09 Sep 2016 18:59:31 GMT]]></title><description><![CDATA[<p dir="auto">In MAPJe71’s posting, he uses <strong>(?m-s)</strong> in his regex.  Isn’t that equivalent to the simpler <strong>(?-s)</strong> ?</p>
<p dir="auto">With <strong>?m</strong> I notice that I get different results in these 2 cases, and it doesn’t seem like I should (in both cases I start with editing caret in column 1 of line 1 of the file):</p>
<p dir="auto"><strong>Case 1:</strong><br />
Find what:  (?m)(.*\R){26}\K.*\R<br />
. matches newline <strong>UN</strong>checked<br />
<strong>result:</strong>  selects line 27 of file</p>
<p dir="auto"><strong>Case 2:</strong><br />
Find what:  <strong>same as Case 1</strong><br />
. matches newline <strong>CHECKED</strong><br />
<strong>result:</strong> selects text of entire file</p>
]]></description><link>https://community.notepad-plus-plus.org/post/17804</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17804</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Fri, 09 Sep 2016 18:59:31 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Double your words on Fri, 09 Sep 2016 18:35:51 GMT]]></title><description><![CDATA[<p dir="auto">Hi <strong>Vasile Caraus</strong> and <strong>MAPJe71</strong></p>
<p dir="auto"><strong>MAPJe71</strong>, although your regex works <strong>perfectly well</strong>, I would like to propose a <strong>shorter</strong> regex :</p>
<p dir="auto">SEARCH = <strong><code>(?-s).+\R</code></strong></p>
<p dir="auto">REPLACE = <strong><code>$0$0</code></strong></p>
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong>in-line</strong> modifier <strong><code>(?-s)</code></strong>, at <strong>beginning</strong> of the regex, ensures that the <strong>dot</strong> meta-character will <strong>always</strong> match a <strong>standard</strong> character only, even if you previously checked the <strong>. matches newline</strong> option, in the <strong>Find/Replace</strong> dialog</p>
</li>
<li>
<p dir="auto">The last part <strong><code>.+\R</code></strong> represents <strong>all</strong> the characters of a <strong>NON-empty</strong> line <strong>AND</strong> its <strong>End Of Line</strong> character(s), whatever they are ( <strong><code>\r\n</code></strong> in <strong>Windows</strong> files, <strong><code>\n</code></strong> in <strong>Unix</strong> files or <strong><code>\r</code></strong> in <strong>Old Mac</strong> files )</p>
</li>
<li>
<p dir="auto">In the <strong>replacement</strong> part, the syntax <strong><code>$0</code></strong> stands for the <strong>totality</strong> of the match, that is to say <strong>all</strong> the contents of <strong>each</strong> line WITH its <strong>End Of Line</strong> character(s). This syntax is just written <strong>twice</strong> as the goal is to to repeat each line, once ! If you would “<strong>triple</strong>” each line, just use the syntax <strong><code>$0$0$0</code></strong>, in the <strong>replacement</strong> part :-)</p>
</li>
</ul>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">I must admit that <strong>my</strong> regex is not so accurate as <strong>MAPJe71</strong>’s one !</p>
<p dir="auto">Indeed, if the cursor is located in the <strong>middle</strong> of a line, <strong>only</strong> the part, from the <strong>cursor</strong> location to the <strong>end</strong> of a line, will be <strong>doubled</strong> … or <strong>tripled</strong> :-(</p>
]]></description><link>https://community.notepad-plus-plus.org/post/17803</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17803</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 09 Sep 2016 18:35:51 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Double your words on Thu, 08 Sep 2016 19:45:40 GMT]]></title><description><![CDATA[<p dir="auto">You might wanna use …<br />
Search: <code>(?m-s)^([^\r\n]+(?:\r?\n|\r))</code><br />
Replace: <code>\1\1</code><br />
… to double the lines.</p>
<p dir="auto"><code>(?m-s)</code> means <code>^</code> and <code>$</code> match at line breaks, a dot does not.<br />
<code>^</code> start at the beginning of a line.<br />
<code>(</code> marks start of the numbered capture group.<br />
<code>[^\r\n]+</code> skip characters not a line break, using <code>+</code> instead of <code>*</code> makes sure empty lines are skipped.<br />
<code>(?:\r?\n|\r)</code> match a line break (Windows, Unix or Mac), no need to capture (i.e. <code>?:</code>) as already part of numbered capture group.<br />
<code>)</code> marks end of the numbered capture group.</p>
<p dir="auto"><code>\1\1</code> doubles the numbered capture group and includes line breaks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/17761</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17761</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Thu, 08 Sep 2016 19:45:40 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Double your words on Thu, 08 Sep 2016 18:01:45 GMT]]></title><description><![CDATA[<p dir="auto">This will double the lines:</p>
<p dir="auto">Search  <code>^(.+)$ </code><br />
Replace with  <code>\1(\2)\n(\1)</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/17758</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/17758</guid><dc:creator><![CDATA[Vasile Caraus]]></dc:creator><pubDate>Thu, 08 Sep 2016 18:01:45 GMT</pubDate></item></channel></rss>