<?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[Q: How to sort groups of lines alphabetically according to the first word after the beginning of each group]]></title><description><![CDATA[<p dir="auto">I am searching for a function in notepad++ that lets me sort groups of lines in this way:</p>
<ul>
<li>The group of lines ist between two regular words <em>for example</em> <strong>&lt;article&gt; and &lt;/article&gt;</strong><br />
After  &lt;article&gt; I have a variable word * for example* <strong>human</strong><br />
In the next group I have another word <em>for example</em> <strong>animal</strong><br />
I want to sort the groups of lines alphabetically according to the word after &lt;article&gt;</li>
</ul>
<hr />
<h2>Example:<br />
&lt;article&gt;<strong>h</strong>uman<br />
Content<br />
Of<br />
Many<br />
Lines<br />
&lt;/article&gt;<br />
&lt;article&gt;<strong>a</strong>nimal<br />
Content<br />
Of<br />
Another<br />
Many<br />
Lines<br />
&lt;/article&gt;<br />
&lt;article&gt;<strong>t</strong>hing<br />
Content<br />
Of<br />
Other<br />
Many<br />
Lines<br />
&lt;/article&gt;</h2>
<p dir="auto">I want to sort them alphabetically in this way:<br />
&lt;article&gt;<strong>a</strong>nimal<br />
Content<br />
Of<br />
Another<br />
Many<br />
Lines<br />
&lt;/article&gt;<br />
&lt;article&gt;<strong>h</strong>uman<br />
Content<br />
Of<br />
Many<br />
Lines<br />
&lt;/article&gt;<br />
&lt;article&gt;<strong>t</strong>hing<br />
Content<br />
Of<br />
Other<br />
Many<br />
Lines<br />
&lt;/article&gt;<br />
,<br />
I hope that you help me<br />
Thanks in advance</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/17170/q-how-to-sort-groups-of-lines-alphabetically-according-to-the-first-word-after-the-beginning-of-each-group</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 05:58:21 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/17170.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 22 Feb 2019 18:47:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Q: How to sort groups of lines alphabetically according to the first word after the beginning of each group on Sat, 23 Feb 2019 01:56:49 GMT]]></title><description><![CDATA[<p dir="auto">Thanks very much.<br />
It worked fine.<br />
I have put<br />
\R(?!(&lt;article&gt;(.+?)&lt;/article&gt;))<br />
Then the same method</p>
<p dir="auto">Best wishes</p>
]]></description><link>https://community.notepad-plus-plus.org/post/40181</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/40181</guid><dc:creator><![CDATA[Ziad Aborami]]></dc:creator><pubDate>Sat, 23 Feb 2019 01:56:49 GMT</pubDate></item><item><title><![CDATA[Reply to Q: How to sort groups of lines alphabetically according to the first word after the beginning of each group on Fri, 22 Feb 2019 20:42:03 GMT]]></title><description><![CDATA[<p dir="auto">By way of explanation: I chose a smiley face as a “record separator” that was unlikely to occur in your data.  If it does, pick any other unicode character you are sure isn’t in your data.  I was originally going to replace with a space, but I realized that, even though your data doesn’t show any of the lines inside an <code>&lt;article&gt;...&lt;/article&gt;</code> having a space, with how artificial your data was, I assumed you may have oversimplified the example, and didn’t want to risk you coming back and saying “but I had a space”.  Note that assumptions like these are good reasons for providing sufficient data to tell what you really want, and what are allowed and not allowed situations.</p>
<p dir="auto">-----<br />
FYI:</p>
<blockquote>
<p dir="auto">This forum is formatted using <a href="https://daringfireball.net/projects/markdown/syntax" rel="nofollow ugc">Markdown</a>, with a help link buried on the little grey <code>?</code> in the COMPOSE window/pane when writing your post.  For more about how to use Markdown in this forum, please see <a href="https://notepad-plus-plus.org/community/topic/14262/how-to-markdown-code-on-this-forum/4" rel="nofollow ugc">@Scott-Sumner’s post in the “how to markdown code on this forum” topic</a>, and my updates <a href="https://notepad-plus-plus.org/community/topic/14262/how-to-markdown-code-on-this-forum/9" rel="nofollow ugc">near the end</a>.  It is very important that you use these formatting tips – using single backtick marks around small snippets, and using code-quoting for pasting multiple lines from your example data files – because otherwise, the forum will change normal quotes (<code>""</code>) to curly “smart” quotes (<code>“”</code>), will change hyphens to dashes, will sometimes hide asterisks (or if your text is <code>c:\folder\*.txt</code>, it will show up as <code>c:\folder*.txt</code>, missing the backslash).  If you want to clearly communicate your text data to us, you <em>need</em> to properly format it.<br />
If you have further search-and-replace (“matching”, “marking”, “bookmarking”, regular expression, “regex”) needs, study <a href="https://notepad-plus-plus.org/community/topic/15765/faq-desk-where-to-find-regex-documentation" rel="nofollow ugc">this FAQ</a> and the documentation it points to.  Before asking a new regex question, understand that for future requests, many of us will expect you to show what data you have (exactly), what data you want (exactly), what regex you already tried (to show that you’re showing effort), why you thought that regex would work (to prove it wasn’t just something randomly typed), and what data you’re getting with an explanation of why that result is wrong. When you show that effort, you’ll see us bend over backward to get things working for you.  If you need help formatting, see the paragraph above.<br />
Please note that for all regex and related queries, it is best if you are explicit about what needs to match, <em>and</em> what <em>shouldn’t</em> match, and have multiple examples of both in your example dataset.  Often, what <em>shouldn’t match</em> helps define the regular expression as much or more than what <em>should match</em>.</p>
</blockquote>
]]></description><link>https://community.notepad-plus-plus.org/post/40176</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/40176</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 22 Feb 2019 20:42:03 GMT</pubDate></item><item><title><![CDATA[Reply to Q: How to sort groups of lines alphabetically according to the first word after the beginning of each group on Fri, 22 Feb 2019 20:01:39 GMT]]></title><description><![CDATA[<p dir="auto">Step 0: Assume no smiley faces (☺ U+263A) in the data set; assumes windows newlines (CRLF = <code>\r\n</code>)<br />
Step 1: Find <code>\R(?!&lt;article&gt;)</code> (any newline not followed by the next starting <code>&lt;article&gt;</code>), replace with <code>\x{263a}</code> (smiley face), regular expression mode<br />
Step 2: <strong>Edit &gt; Line Operations &gt; Sort Lines Lexicographically Ascending</strong><br />
Step 3: Find <code>\x{263a}</code>, replace <code>\r\n</code>, regular expression</p>
]]></description><link>https://community.notepad-plus-plus.org/post/40172</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/40172</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 22 Feb 2019 20:01:39 GMT</pubDate></item></channel></rss>