<?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[How to merge 2 seperate lines into 1 and add a colon in between?]]></title><description><![CDATA[<p dir="auto">Text:</p>
<pre><code>user
pass

user1
pass1

user2
pass2
</code></pre>
<p dir="auto">What i need:</p>
<pre><code>user:pass
user1:pass1
user2:pass2
</code></pre>
<p dir="auto">What can i do to solve this? I’d be glad to hear your thoughts</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/16402/how-to-merge-2-seperate-lines-into-1-and-add-a-colon-in-between</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 22:05:36 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/16402.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 30 Sep 2018 08:57:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to merge 2 seperate lines into 1 and add a colon in between? on Sun, 30 Sep 2018 12:48:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sani-bani" aria-label="Profile: sani-bani">@<bdi>sani-bani</bdi></a></p>
<p dir="auto">Try this:</p>
<p dir="auto">Invoke <strong>Replace</strong> dialog (default key: ctrl+h)<br />
<strong>Find what</strong> zone: <code>(?-s)^(.+)\R(.+)(?:\R|\z)</code><br />
<strong>Replace with</strong> zone: <code>\1:\2</code><br />
<strong>Wrap around</strong> checkbox: ticked or unticked, as you like<br />
<strong>Search mode</strong> selection: <em>Regular expression</em><br />
Action: Press <strong>Replace</strong> or <strong>Replace All</strong> button, as you like</p>
<p dir="auto">Here’s how it works:</p>
<h4>THE FIND EXPRESSION:</h4>
<p dir="auto"><code>(?-s)^(.+)\R(.+)(?:\R|\z)</code></p>
<ul>
<li>[Use these options for the whole regular expression][<em><strong>1</strong></em> ] <code>(?-s)</code>
<ul>
<li>[(hyphen inverts the meaning of the letters that follow)][<em><strong>1</strong></em> ] <code>-</code></li>
<li>[Dot doesn’t match line breaks][<em><strong>1</strong></em> ] <code>s</code></li>
</ul>
</li>
<li>[Assert position at the beginning of a line (at beginning of the string or after a line break character) (carriage return and line feed, form feed)][<em><strong>2</strong></em> ] <code>^</code></li>
<li>[Match the regex below and capture its match into backreference number 1][<em><strong>3</strong></em> ] <code>(.+)</code>
<ul>
<li>[Match any single character that is NOT a line break character (line feed, carriage return, form feed)][<em><strong>4</strong></em> ] <code>.+</code>
<ul>
<li>[Between one and unlimited times, as many times as possible, giving back as needed (greedy)][<em><strong>5</strong></em> ] <code>+</code></li>
</ul>
</li>
</ul>
</li>
<li>[Match a line break (carriage return and line feed pair, sole line feed, sole carriage return, vertical tab, form feed)][<em><strong>6</strong></em> ] <code>\R</code></li>
<li>[Match the regex below and capture its match into backreference number 2][<em><strong>3</strong></em> ] <code>(.+)</code>
<ul>
<li>[Match any single character that is NOT a line break character (line feed, carriage return, form feed)][<em><strong>4</strong></em> ] <code>.+</code>
<ul>
<li>[Between one and unlimited times, as many times as possible, giving back as needed (greedy)][<em><strong>5</strong></em> ] <code>+</code></li>
</ul>
</li>
</ul>
</li>
<li>[Match the regular expression below][<em><strong>3</strong></em> ] <code>(?:\R|\z)</code>
<ul>
<li>[Match this alternative (attempting the next alternative only if this one fails)][<em><strong>7</strong></em> ] <code>\R</code>
<ul>
<li>[Match a line break (carriage return and line feed pair, sole line feed, sole carriage return, vertical tab, form feed)][<em><strong>6</strong></em> ] <code>\R</code></li>
</ul>
</li>
<li>[Or match this alternative (the entire group fails if this one fails to match)][<em><strong>7</strong></em> ] <code>\z</code>
<ul>
<li>[Assert position at the very end of the string][<em><strong>8</strong></em> ] <code>\z</code></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>THE REPLACE EXPRESSION:</h4>
<p dir="auto"><code>\1:\2</code></p>
<ul>
<li>[Insert the text that was last matched by capturing group number 1][<em><strong>9</strong></em> ] <code>\1</code></li>
<li>[Insert a colon][<em><strong>10</strong></em> ] <code>:</code></li>
<li>[Insert the text that was last matched by capturing group number 2][<em><strong>9</strong></em> ] <code>\2</code></li>
</ul>
<p dir="auto">Created with <a href="https://www.regexbuddy.com/" rel="nofollow ugc">RegexBuddy</a></p>
<p dir="auto">[<em><strong>1</strong></em> ]: <a href="https://www.regular-expressions.info/modifiers.html" rel="nofollow ugc">https://www.regular-expressions.info/modifiers.html</a><br />
[<em><strong>2</strong></em> ]: <a href="https://www.regular-expressions.info/anchors.html" rel="nofollow ugc">https://www.regular-expressions.info/anchors.html</a><br />
[<em><strong>3</strong></em> ]: <a href="https://www.regular-expressions.info/brackets.html" rel="nofollow ugc">https://www.regular-expressions.info/brackets.html</a><br />
[<em><strong>4</strong></em> ]: <a href="https://www.regular-expressions.info/dot.html" rel="nofollow ugc">https://www.regular-expressions.info/dot.html</a><br />
[<em><strong>5</strong></em> ]: <a href="https://www.regular-expressions.info/repeat.html" rel="nofollow ugc">https://www.regular-expressions.info/repeat.html</a><br />
[<em><strong>6</strong></em> ]: <a href="https://www.regular-expressions.info/nonprint.html" rel="nofollow ugc">https://www.regular-expressions.info/nonprint.html</a><br />
[<em><strong>7</strong></em> ]: <a href="https://www.regular-expressions.info/alternation.html" rel="nofollow ugc">https://www.regular-expressions.info/alternation.html</a><br />
[<em><strong>8</strong></em> ]: <a href="https://www.regular-expressions.info/anchors.html#az" rel="nofollow ugc">https://www.regular-expressions.info/anchors.html#az</a><br />
[<em><strong>9</strong></em> ]: <a href="https://www.regular-expressions.info/replacebackref.html" rel="nofollow ugc">https://www.regular-expressions.info/replacebackref.html</a><br />
[<em><strong>10</strong></em> ]: <a href="https://www.regular-expressions.info/characters.html" rel="nofollow ugc">https://www.regular-expressions.info/characters.html</a></p>
<p dir="auto">RegexBuddy settings to emulate N++ regex engine: Application=boost::regex 1.54-1.57 / flavor=Default flavor / replacement flavor=All flavor / ^$ match at line breaks / Numbered capture / Allow zero-length matches</p>
]]></description><link>https://community.notepad-plus-plus.org/post/35165</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/35165</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sun, 30 Sep 2018 12:48:30 GMT</pubDate></item></channel></rss>