<?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 find numbers in multiline in Notepad++]]></title><description><![CDATA[<p dir="auto">Hello everyone. If I have multiple formats like this in my text file, how can i sort out the number in notepad++ in multiline format, I tried to use multiline plugin but didn’t get any success, or maybe i am noob in regex. Can any pro help me to find this solution.</p>
<p dir="auto"><strong>Example one</strong><br />
1234567891<br />
abcd :<br />
111/22 or 111|22 (another format)<br />
xyz :<br />
333<br />
product :<br />
blablabla 456<br />
code :<br />
01010<br />
serial :<br />
8888899999</p>
<p dir="auto"><strong>Example two</strong><br />
aaaa:: 1234567891<br />
xyz: 333<br />
abcd: 111<br />
efgh: 22<br />
product: blablabla 456<br />
product2: 456 blablabla<br />
code: 01010<br />
serial: 8888899999</p>
<p dir="auto"><strong>Example Three</strong><br />
aaaa:: 1234567891<br />
xyz: 333<br />
abcd: 111<br />
efgh: 22</p>
<p dir="auto"><strong>Output from all these examples I am looking for</strong><br />
1234567891|111|22|333<br />
1234567891|111|22|333<br />
1234567891|111|22|333</p>
<p dir="auto"><strong>if above is not possible then</strong><br />
1234567891|333|111|22<br />
1234567891|333|111|22<br />
1234567891|333|111|22</p>
<p dir="auto"><em>Can we do that with RegEx or any other method or tool?</em> I have tried the multiline plugin, but it didn’t worked out for me or maybe i am not sure how to use it properly.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/22208/how-to-find-numbers-in-multiline-in-notepad</link><generator>RSS for Node</generator><lastBuildDate>Fri, 12 Jun 2026 23:37:01 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/22208.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 30 Nov 2021 13:00:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Mon, 13 Dec 2021 13:21:18 GMT]]></title><description><![CDATA[<p dir="auto">So this is a good discussion thread, but the choice to use literal <code>1</code>, <code>2</code>, <code>3</code> in the examples IMO wasn’t the best for the utmost clarity.  :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/72073</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/72073</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 13 Dec 2021 13:21:18 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Sat, 11 Dec 2021 22:47:38 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">To summarize :</p>
<ul>
<li>
<p dir="auto">With the syntax <strong><code>^(1+)?•••••</code></strong>, group <strong><code>1</code></strong> <strong>must</strong> contain some <strong><code>1'</code></strong>. So, if <strong>no</strong> <strong><code>1'</code></strong> can be found in text, the group <strong><code>1</code></strong> <strong>cannot</strong> be defined and is not used as <strong>optional</strong><br />
(<strong><code>?</code></strong> quantifier )</p>
</li>
<li>
<p dir="auto">With the syntax <strong><code>^(1*)•••••</code></strong>, group <strong><code>1</code></strong> <strong>may or not</strong> contain some <strong><code>1'</code></strong>. So, if <strong>no</strong> <strong><code>1'</code></strong> can be found in text, the group <strong><code>1</code></strong> is <strong>still defined</strong> with <strong>empty</strong> contents<br />
(<strong><code>*</code></strong> quantifier )</p>
</li>
<li>
<p dir="auto">With the syntax <strong><code>^(1)*•••••</code></strong>, group <strong><code>1</code></strong> <strong>must</strong> contain <strong>one</strong> <strong><code>1'</code></strong>. So, if <strong>no</strong> <strong><code>1'</code></strong> can be found in text, the group <strong><code>1</code></strong> <strong>cannot</strong> be defined and is not used as <strong>optional</strong><br />
(<strong><code>*</code></strong> quantifier )</p>
</li>
</ul>
<hr />
<p dir="auto">So, given the text :</p>
<pre><code class="language-diff">000000 |
111111 |
222222 |
333333 |
111222 |
111133 |
223333 |
112233 |
</code></pre>
<p dir="auto">The regex S/R :</p>
<p dir="auto">SEARCH <strong><code>(?-s)^(1+)?(2+)?(3+)?.+</code></strong></p>
<p dir="auto">REPLACE <strong><code>$0 groups (?{1}1:.)(?{2}2:.)(?{3}3:.)</code></strong></p>
<p dir="auto">gives :</p>
<pre><code class="language-diff">000000 | groups ...
111111 | groups 1..
222222 | groups .2.
333333 | groups ..3
111222 | groups 12.
111133 | groups 1.3
223333 | groups .23
112233 | groups 123
</code></pre>
<p dir="auto">The regex S/R :</p>
<p dir="auto">SEARCH <strong><code>(?-s)^(1*)(2*)(3*).+</code></strong></p>
<p dir="auto">REPLACE <strong><code>$0 groups (?{1}1:.)(?{2}2:.)(?{3}3:.)</code></strong></p>
<p dir="auto">gives :</p>
<pre><code class="language-diff">000000 | groups 123
111111 | groups 123
222222 | groups 123
333333 | groups 123
111222 | groups 123
111133 | groups 123
223333 | groups 123
112233 | groups 123
</code></pre>
<p dir="auto">And the regex S/R :</p>
<p dir="auto">SEARCH <strong><code>(?-s)^(1)*(2)*(3)*.+</code></strong></p>
<p dir="auto">REPLACE <strong><code>$0 groups (?{1}1:.)(?{2}2:.)(?{3}3:.)</code></strong></p>
<p dir="auto">gives :</p>
<pre><code class="language-diff">000000 | groups ...
111111 | groups 1..
222222 | groups .2.
333333 | groups ..3
111222 | groups 12.
111133 | groups 1.3
223333 | groups .23
112233 | groups 123
</code></pre>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/72053</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/72053</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 11 Dec 2021 22:47:38 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Sat, 11 Dec 2021 09:48:23 GMT]]></title><description><![CDATA[<p dir="auto">Good write up, <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>. It’s good to know there’s a way to have a group conditionally defined as you showed.</p>
<blockquote>
<p dir="auto">To get a functional overall regex, you need to change this non-optional group 1 (\d*) into an optional group, with a non-optional contents…, thanks to the syntax (\d+)?</p>
</blockquote>
<p dir="auto">At first it seemed like this property of <code>(spec+)?</code> was an anomaly being exploited, or maybe an afterthought by the regex authors, but upon reflection there is some sense to it:</p>
<p dir="auto">In cases where <code>(spec)</code> has no match…</p>
<ul>
<li>
<p dir="auto">with <code>(spec*)</code> the (little man in the) machine says, "you asked for a capture group containing zero or more matches, so I’m giving you <strong>a capture group that contains</strong> null text; and <strong><em><strong>a thing which contains</strong></em> surely must be defined</strong>.</p>
</li>
<li>
<p dir="auto">with <code>(spec+)?</code> the (little man in the) machine says, "you asked for <strong>zero or one</strong> capture groups containing matched text, so I give you zero such groups, and <strong>a thing of which there are zero (in compsci) has no memory allocated and no address, ie, is undefined</strong></p>
</li>
</ul>
<p dir="auto">After realizing this, I wondered if some sticky situations might arise using this technique when there’s a sequence of these conditionally defined groups (ConDefGrps for short). Consider an expression in which all capture groups (CaptGrps) are also ConDefGrps, and, say the first ConDefGrp doesn’t match, so a CaptGrp isn’t defined, but, the second one does; since this latter one is the first CaptGrp that “comes to life”, wouldn’t its reference be 1 so that any conditional test on it (no matter if later in the same expression or in the substitution statement) would actually be testing for the existence of that second appearing, first defined CaptGrp?</p>
<p dir="auto">So I set up a test to check this.</p>
<p dir="auto">Consider a scheme in which a valid code consists of zero or more number 1’s, then 2’s, then 3’s, in that order, with at least one element present.</p>
<p dir="auto">An expression that only matches lines completely filled by a valid code is: <code>^(?=\S)([1]+)?([2]+)?([3]+)?$</code> but that’s not so interesting.</p>
<p dir="auto">Here’s an F/R pair that always captures the whole line whether it contains valid codes or not, and then writes it back with information about each group’s existence appended:</p>
<p dir="auto">F: <code>^([1]+)?([2]+)?([3]+)?.*$</code><br />
R: <code>$0 - groups (?{1}1:.)(?{2}2:.)(?{3}3:.)</code></p>
<p dir="auto">When applied to this test data:</p>
<pre><code>1
2
3

112
1222222223
2233111111
4
4123
12z3
1111111222223333
31
32
1133
</code></pre>
<p dir="auto">we obtain:</p>
<pre><code>1 - groups 1..
2 - groups .2.
3 - groups ..3
 - groups ...
112 - groups 12.
1222222223 - groups 123
2233111111 - groups .23
4 - groups ...
4123 - groups ...
12z3 - groups 12.
1111111222223333 - groups 123
31 - groups ..3
32 - groups ..3
1133 - groups 1.3
</code></pre>
<p dir="auto">What the above demonstrates is that when a ConDefGrp is encountered in an expression, even though it may remain “undefined” (and return False in an existence test) <strong>it still consumes a group <em><strong>number</strong></em></strong> allocated in the normal fashion.</p>
<p dir="auto">Thus, one need not worry that including multiple ConDefGrps might lead to ambiguity in the mapping of group to group number.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/72046</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/72046</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Sat, 11 Dec 2021 09:48:23 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Thu, 09 Dec 2021 10:32:36 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: Neil-Schipper">@<bdi>Neil-Schipper</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I had <strong>never</strong> done this test :</p>
<p dir="auto">SEARCH <strong><code>()</code></strong></p>
<p dir="auto">REPLACE <strong><code>(?1dog:cat)</code></strong></p>
<p dir="auto">Interesting ! You said :</p>
<blockquote>
<p dir="auto">In the case of a new empty file, there are 0 matches. This seems wrong,…</p>
</blockquote>
<p dir="auto">Well, your assertion is a bit philosophical : does an <strong>empty</strong> file contains a <strong>single empty</strong> string ( or an <strong>infinity</strong> ! ) ?</p>
<p dir="auto">Note that , in <strong>regex</strong> mode, the search of <strong><code>()</code></strong> ( an <strong>empty</strong> group <strong><code>1</code></strong> ) does show the <strong><code>^ zero length match</code></strong> calltip, when applied to a <strong>new empty</strong> tab or a <strong>zero byte</strong> file !</p>
<p dir="auto">However, as you said, even a simple <strong>replacement</strong> with a dummy string, as for instance <strong><code>Test</code></strong>, does <strong>not</strong> occur and <strong>no</strong> text is inserted !</p>
<p dir="auto">Now, if I type in the phrase <strong>This is a test</strong> in a <strong>new</strong> tab and I use the regex S/R :</p>
<p dir="auto">SEARCH <strong><code>()</code></strong></p>
<p dir="auto">REPLACE <strong><code>?1:|:x</code></strong></p>
<p dir="auto">I get, after clicking on the <strong><code>Replace All</code></strong> button, with the <strong><code>Wrap around</code></strong> option ticked, the text :</p>
<pre><code class="language-diff">|T|h|i|s| |i|s| |a| |t|e|s|t|
</code></pre>
<p dir="auto">And, to my mind, all this is quite <strong>logic</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong>group <code>1</code></strong> is <strong>defined</strong> and contains an <strong>empty</strong> string</p>
</li>
<li>
<p dir="auto">Technically, an <strong>empty</strong> string does exist between <strong>two</strong> characters, as well as before the <strong>first</strong> char and after the <strong>last</strong>. So <strong>each</strong> occurrence is changed into the <strong><code>|</code></strong> char</p>
</li>
</ul>
<p dir="auto">Note that we can obtain the <strong>same</strong> result with this other regex S/R :</p>
<p dir="auto">SEARCH <strong><code>(.{0})</code></strong></p>
<p dir="auto">REPLACE <strong><code>?1:|:x</code></strong></p>
<p dir="auto">and also with the more <strong>simple</strong> forms :</p>
<p dir="auto">SEARCH <strong><code>()</code></strong></p>
<p dir="auto">REPLACE <strong><code>|</code></strong></p>
<p dir="auto">or</p>
<p dir="auto">SEARCH <strong><code>.{0}</code></strong></p>
<p dir="auto">REPLACE <strong><code>|</code></strong></p>
<hr />
<p dir="auto">As we’re speaking about <strong>empty</strong> groups, I would like to mention a particular but important point when using <strong>conditional</strong> structures, in <strong>regex</strong> mode :</p>
<p dir="auto">Let’s consider this list :</p>
<pre><code class="language-diff">Ted=First Name
25=Age
Mary=First Name
75=Age
Elisabeth=First Name
47=Age
Bob=First Name
62=Age
</code></pre>
<p dir="auto">Let’s introduce the <strong>conditional</strong> regex structure <strong><code>(?(1)Age|First Name)</code></strong> which means : if a <strong>group <code>1</code></strong> has been <strong>previously</strong> defined, in the <strong>search</strong> regex, searches for the string <strong>Age</strong> else searches for the string <strong>First Name</strong></p>
<p dir="auto">If we build the regex <strong><code>(?-si)^(\d*).*=(?(1)Age|First Name)$</code></strong>, you could say :</p>
<ul>
<li>
<p dir="auto">If a line begins with a number, the part <strong><code>\d*</code></strong> matches this number, the part <strong><code>.*</code></strong> matches an <strong>empty</strong> string <strong><code>=</code></strong> matches the <strong>equal</strong> sign and the <strong>conditional</strong> bloc <strong><code>(?(1)Age|First Name)</code></strong> matches the string <strong>Age</strong> as the <strong>group <code>1</code></strong> contains the number and is <strong>defined</strong></p>
</li>
<li>
<p dir="auto">If a line does <strong>not</strong> begin with a number, the part <strong><code>\d*</code></strong> matches an <strong>empty</strong> string, the part <strong><code>.*</code></strong> matches the <strong>first name</strong>, <strong><code>=</code></strong> matches the <strong>equal</strong> sign and the <strong>conditional</strong> bloc <strong><code>(?(1)Age|First Name)</code></strong> matches the string <strong>First Name</strong> as the <strong>group <code>1</code></strong> is <strong>not</strong> defined and <strong>empty</strong></p>
</li>
</ul>
<p dir="auto">However, running this regex, against our text, it matches <strong>only</strong> the lines relative to the <strong>age</strong> and <strong>not all</strong> the lines. Why ?</p>
<p dir="auto">Well, what really represents the <strong><code>(\d*)</code></strong> group, after the <strong><code>^</code></strong> assertion :</p>
<ul>
<li>
<p dir="auto">If a line begins with some digits, no problem : <strong>group <code>1</code></strong> is <strong>defined</strong> and contains the number</p>
</li>
<li>
<p dir="auto">Now, if a line does <strong>not</strong> begin with digits, the <strong>group <code>1</code></strong> is <em>ALSO</em> <strong>defined</strong> but contains an <strong>empty</strong> string</p>
</li>
</ul>
<p dir="auto">Thus, in <strong>all</strong> cases the <strong>group <code>1</code></strong> is <strong>defined</strong>;, breaking the <strong>normal</strong> behaviour of the <strong>conditional</strong> part <strong><code>(?(1)Age|First Name)</code></strong></p>
<p dir="auto">To get a <strong>functional</strong> overall regex, you need to change this <strong>non-optional</strong> group <strong><code>1</code></strong> <strong><code>(\d*)</code></strong> into an <strong>optional</strong> group, with a <strong>non-optional</strong> contents…, thanks to the syntax <strong><code>(\d+)?</code></strong>. Then, the search regex becomes :</p>
<p dir="auto"><strong><code>(?-si)^(\d+)?.*=(?(1)Age|First Name)$</code></strong></p>
<p dir="auto">This time :</p>
<ul>
<li>
<p dir="auto">If a line begins with a number, the <strong>optional</strong> part <strong><code>(\d+)?</code></strong> matches this number and the <strong>group <code>1</code></strong> is clearly <strong>defined</strong> and contains this number</p>
</li>
<li>
<p dir="auto">But, if a line does <strong>not</strong> begin with a number the <strong>optional</strong> part <strong><code>(\d+)?</code></strong> matches <strong>nothing</strong> and the <strong>group <code>1</code></strong> is <strong>not</strong> defined at all !</p>
</li>
</ul>
<p dir="auto">You can verify that this <strong>final</strong> regex find, as <strong>expected</strong>, <strong>all</strong> the lines of our text !</p>
<p dir="auto"><strong>Remark</strong> : Of course, we could had simply used the regex <strong><code>(?-si)^(\d+=Age|.+=First Name)$</code></strong>, without any <strong>conditional</strong> block !</p>
<hr />
<p dir="auto">This reasoning can be applied, as well, to <strong>conditional</strong> replacements ! For instance, given this text :</p>
<pre><code class="language-diff">Ted
25
Mary
75
Elisabeth
47
Bob
62
</code></pre>
<p dir="auto">The following regex S/R :</p>
<p dir="auto">SEARCH <strong><code>(?-s)^(\d+)?.*$</code></strong></p>
<p dir="auto">REPLACE <strong><code>(?1Age:First Name) : $&amp;</code></strong></p>
<p dir="auto">would gives :</p>
<pre><code class="language-diff">First Name : Ted
Age : 25
First Name : Mary
Age : 75
First Name : Elisabeth
Age : 47
First Name : Bob
Age : 62
</code></pre>
<ul>
<li>
<p dir="auto">If a number begins a line, <strong>group <code>1</code></strong> is <strong>defined</strong> and the string <strong>Age</strong>, followed with <strong><code>\x20:\x20</code></strong>, is inserted <strong>right before</strong> the number</p>
</li>
<li>
<p dir="auto">If a number does <strong>not</strong> begin a line, the <strong>group <code>1</code></strong> is <strong>not</strong> defined at all. So the string <strong>First Name</strong>, followed with <strong><code>\x20:\x20</code></strong>, is inserted, this time, <strong>right before</strong> the first name</p>
</li>
</ul>
<p dir="auto">And you’ll verify, that the <strong>similar</strong> version, with the <strong>non-optional</strong> group <strong><code>1</code></strong> <strong><code>(\d*)</code></strong> :</p>
<p dir="auto">SEARCH <strong><code>(?-s)^(\d*).*$</code></strong></p>
<p dir="auto">REPLACE <strong><code>(?1Age:First Name) : $&amp;</code></strong></p>
<p dir="auto">gives <strong>wrong</strong> results, with the string <strong>"Age : "</strong> <em>ALWAYS</em> inserted :-((</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71987</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71987</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 09 Dec 2021 10:32:36 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Wed, 08 Dec 2021 19:55:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> said in <a href="/post/71950">How to find numbers in multiline in Notepad++</a>:</p>
<blockquote>
<p dir="auto">solution which does not depend on the number of lines of a section</p>
</blockquote>
<p dir="auto">Very nice solution. I can see its applicability and am glad to know it so thanks for sharing.</p>
<p dir="auto">I won’t be much help on the follow-up discussion. I’m not even clear on what motivated you to go in this direction:</p>
<blockquote>
<p dir="auto">if we try to factorize the search regex expression</p>
</blockquote>
<p dir="auto">However, in trying to understand one building block of your newer regex, which includes a null in an OR subexpression, I encountered something confusing. I wanted to know “does a captured null return true or false?”</p>
<p dir="auto">So I ran ‘Replace All’ with F=<code>()</code>, R=<code>?1dog:cat</code> on a few cases.</p>
<p dir="auto">In the case of a new empty file, there are 0 matches. This seems wrong, although I wouldn’t be surprised if a more experienced regex person would say it’s correct and expected (because maybe in the docs it says “no text ==&gt; no matches” or maybe, “a zero-length null only occurs before or after a character”).</p>
<p dir="auto">In the case of a file with the single character ‘p’ there are 2 matches and we get <code>dogpdog</code> which seems reasonable.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71982</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71982</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Wed, 08 Dec 2021 19:55:36 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Wed, 08 Dec 2021 21:42:57 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/gelle_marrisa" aria-label="Profile: gelle_marrisa">@<bdi>gelle_marrisa</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">My reasoning, at the end of my <strong>previous</strong> post, about the <strong>second</strong> form of regex <strong><code>\D+(((^\r\n)+|\z)|)</code></strong> is <strong>not</strong> exact ! Indeed, I said :</p>
<blockquote>
<p dir="auto">As the whole regex contains other <strong>alternatives</strong>, the regex engine, <strong>before</strong> backtracking, tries a match attempt with the <strong>second</strong> alternative</p>
</blockquote>
<p dir="auto">But, in this case, the <strong>correct</strong> search regex of my previous post <strong><code>\D+((^\r\n)+|\z)|\D+</code></strong>, which also contains an <strong>alternation</strong>, should show the <strong>same</strong> behavior and <strong>always</strong> choose the <strong>second</strong> alternative <strong><code>\D+</code></strong> ?!</p>
<p dir="auto">I’ve tried to find out an explanation, <strong>without</strong> any success :-( May be, one of yours will be able to find out a <strong>plausible</strong> one !</p>
<hr />
<p dir="auto">In brief, even simplifying the <strong>first</strong> version by <strong>omitting</strong> the <strong><code>\z</code></strong> case , and given this <em>INPUT</em> text, with a <strong>blank</strong> line after the <strong>last</strong> <strong><code>12</code></strong> number</p>
<pre><code class="language-diff">12
abcd :
115/22
xyz :
333
product :
blablabla 4567
code :
01010
serial :
34




56
abcd :
116|22
xyz :




90
abcd :
product :
blablabla 456789
code :
serial :
12

</code></pre>
<p dir="auto"><strong>Why</strong> the regex S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>\D+(^\r\n)+|\D+</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>?1\r\n:|</code></strong></p>
</li>
</ul>
<p dir="auto">gives :</p>
<pre><code class="language-diff">12|115|22|333|4567|01010|34
56|116|22
90|456789|12|
</code></pre>
<p dir="auto">And this second <strong>equivalent</strong> S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>\D+((^\r\n)+|)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>?2\r\n:|</code></strong></p>
</li>
</ul>
<p dir="auto">gives this result :</p>
<pre><code class="language-diff">12|115|22|333|4567|01010|34|56|116|22|90|456789|12|
</code></pre>
<p dir="auto">???</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">The problem does not comes from the <strong>empty</strong> alternative. For instance, the regex  <strong><code>abc(def|)</code></strong> does find, either, the strings <strong><code>abcdef</code></strong> and just <strong><code>abc</code></strong> !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71963</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71963</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 08 Dec 2021 21:42:57 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Wed, 08 Dec 2021 01:18:59 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/gelle_marrisa" aria-label="Profile: gelle_marrisa">@<bdi>gelle_marrisa</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">An other solution which does <strong>not</strong> depend on the <strong>number</strong> of lines of a <strong>section</strong> would be :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>\D+((^\r\n)+|\z)|\D+</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>?1\r\n:|</code></strong></p>
</li>
<li>
<p dir="auto">Tick the <strong><code>Wrap around</code></strong> option</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Replace All</code></strong> button</p>
</li>
</ul>
<p dir="auto">Of course, I assume that <strong>each</strong> section is separated by, at least, <strong>one pure empty</strong> line</p>
<p dir="auto">So, from this <em>INPUT</em> text :</p>
<pre><code class="language-diff">12
abcd :
115/22
xyz :
333
product :
blablabla 4567
code :
01010
serial :
34




56
abcd :
116|22
xyz :




90
abcd :
product :
blablabla 456789
code :
serial :
12
</code></pre>
<p dir="auto">You would obtain this <strong>expected</strong> text :</p>
<pre><code class="language-diff">12|115|22|333|4567|01010|34
56|116|22
90|456789|12
</code></pre>
<hr />
<p dir="auto">Note that if we try to <strong>factorize</strong> the <strong>search</strong> regex expression as below :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>\D+(((^\r\n)+|\z)|)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>?2\r\n:|</code></strong></p>
</li>
</ul>
<p dir="auto">This <strong>regex</strong> S/R does <strong>not</strong> work properly and gives this output :</p>
<pre><code class="language-diff">12|115|22|333|4567|01010|34|56|116|22|90|456789|12
</code></pre>
<p dir="auto">So, why, in this <strong>new</strong> regex, the case <strong><code>\D+(^\r\n)+</code></strong> <strong>never</strong> occurs ? For instance, after the number <strong><code>34</code></strong>, ending the <strong>first</strong> section of my exemple ? Well, we have this range of chars : <strong><code>34\r\n\r\n\r\n\r\n\r\n56</code></strong>. So :</p>
<ul>
<li>
<p dir="auto">First, the regex <strong><code>\D+</code></strong> matches <strong><code>\r\n\r\n\r\n\r\n\r\n</code></strong> but would need some <strong>backtraking</strong> process in order that the <strong>first</strong> alternative <strong><code>\D+(^\r\n)+</code></strong> matches this <strong>same</strong> range</p>
</li>
<li>
<p dir="auto">As the whole regex contains other <strong>alternatives</strong>, the regex engine, <strong>before</strong> backtracking, tries a match attempt with the <strong>second</strong> alternative. However, the regex <strong><code>\D+\z</code></strong> cannot be applied to, at this position !</p>
</li>
<li>
<p dir="auto">Finally, the regex engine tries the <strong>last empty</strong> alternative <strong><code>\D+()</code></strong> which, of course, matches the range <strong><code>\r\n\r\n\r\n\r\n\r\n</code></strong></p>
</li>
</ul>
<p dir="auto">This explains why the gap between <strong>two</strong> sections is <strong>never</strong> detected with this <strong>second</strong> version of the regex S/R</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71950</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71950</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 08 Dec 2021 01:18:59 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Mon, 06 Dec 2021 09:49:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gelle_marrisa" aria-label="Profile: gelle_marrisa">@<bdi>gelle_marrisa</bdi></a></p>
<p dir="auto">To convert this:</p>
<pre><code class="language-txt">12
abcd :
115/22
xyz :
333
product :
blablabla 4567
code :
01010
serial :
34

56
abcd :
116|22
xyz :
333
product :
blablabla 45678
code :
01010
serial :
78

90
abcd :
117|22
xyz :
333
product :
blablabla 456789
code :
01010
serial :
12

</code></pre>
<p dir="auto">into this:</p>
<pre><code class="language-txt">12|115|22|333|4567|01010|34
56|116|22|333|45678|01010|78
90|117|22|333|456789|01010|12
</code></pre>
<p dir="auto">You can use:</p>
<p dir="auto">F: <code>(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+</code><br />
R: <code>$1|$2|$3|$4|$5|$6|$7\r\n</code><br />
Set cursor to the left of first number of first record<br />
Execute Replace All</p>
<p dir="auto">It will only work on your whole file if every record has exactly 7 numbers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71913</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71913</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Mon, 06 Dec 2021 09:49:06 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Mon, 06 Dec 2021 07:28:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a><br />
lets forget the slash value, if there is only 111|22 in 2nd or 3rd line, can we get the desired result?</p>
<p dir="auto">\d{10}\R\d{3}/\d{2}\R\d{3} this shows pattern error,</p>
<p dir="auto">I am noob, \d{3}[/|]\d{2} not sure to use it as complete pattern or i have to merge it with any previous pattern that was mentioned above.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71908</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71908</guid><dc:creator><![CDATA[gelle_marrisa]]></dc:creator><pubDate>Mon, 06 Dec 2021 07:28:22 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Mon, 06 Dec 2021 07:15:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gelle_marrisa" aria-label="Profile: gelle_marrisa">@<bdi>gelle_marrisa</bdi></a> The regex I provided you is tested on the text quoted just above it. All it does is match either of the 6 character strings in the quote. I provided it on the assumption that you were trying to learn techniques to help solve your overall problem. It was <em>not</em> intended as a complete solution.</p>
<p dir="auto">If you want help with a complete solution, you will need to read, with care, with attention, with seriousness, my remarks about the importance of being able to determine the start and the end of records in your data.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71906</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71906</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Mon, 06 Dec 2021 07:15:47 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Mon, 06 Dec 2021 07:06:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a><br />
suppose if there is only 1 format for abcd area(no slash), then is there possibility to get the solution? I can replace all the slashes in first place and then use the regex.<br />
1234567891<br />
abcd :<br />
111|22<br />
xyz :<br />
333<br />
product :<br />
blablabla 456<br />
code :<br />
01010<br />
serial :<br />
8888899999</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71905</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71905</guid><dc:creator><![CDATA[gelle_marrisa]]></dc:creator><pubDate>Mon, 06 Dec 2021 07:06:52 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Mon, 06 Dec 2021 06:57:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/neil-schipper" aria-label="Profile: neil-schipper">@<bdi>neil-schipper</bdi></a><br />
this didn’t worked even. can you share an example in regex tester</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71904</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71904</guid><dc:creator><![CDATA[gelle_marrisa]]></dc:creator><pubDate>Mon, 06 Dec 2021 06:57:44 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Mon, 06 Dec 2021 06:56:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a><br />
thanks. it gives me pattern error.<br />
<a href="https://regex101.com/r/p5XPbT/1/" rel="nofollow ugc">https://regex101.com/r/p5XPbT/1/</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/71903</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71903</guid><dc:creator><![CDATA[gelle_marrisa]]></dc:creator><pubDate>Mon, 06 Dec 2021 06:56:37 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Sun, 05 Dec 2021 14:03:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gelle_marrisa" aria-label="Profile: gelle_marrisa">@<bdi>gelle_marrisa</bdi></a> said in <a href="/post/71862">How to find numbers in multiline in Notepad++</a>:</p>
<blockquote>
<p dir="auto">it combines all the letters in one row instead of separate rows</p>
</blockquote>
<blockquote>
<p dir="auto">any solution to keep rows</p>
</blockquote>
<p dir="auto">So what you hope to achieve is one line of data per record, yes? Your file consists of records with slightly different formats (for example, some but perhaps not all records start with <code>aaaa:: </code>), yes? So it will be necessary to be able to reliably determine when one record ends and the next one starts. You should try to describe all the record-boundary conditions, or, provide examples covering every type of record that you expect to be encountered and from which you want numbers extracted.</p>
<blockquote>
<p dir="auto">111/22 or 111|22 (another format)</p>
</blockquote>
<p dir="auto">An expression that will match either format is: <code>\d{3}[/|]\d{2}</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/71882</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71882</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Sun, 05 Dec 2021 14:03:43 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Sat, 04 Dec 2021 17:53:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gelle_marrisa" aria-label="Profile: gelle_marrisa">@<bdi>gelle_marrisa</bdi></a> said in <a href="/post/71862">How to find numbers in multiline in Notepad++</a>:</p>
<blockquote>
<p dir="auto">or used \n for next line</p>
</blockquote>
<p dir="auto"><code>\n</code> means the LF portion of the Windows-standard CRLF sequence; the CR portion is <code>\r</code>.  If you want to match a newline in your regular expression, you thus need to use <code>\r\n</code>.  Alternatively, in Notepad++'s “Boost regular expressions”, <code>\R</code> will match a Windows-style <code>\r\n</code> or a linux-style <code>\n</code> or even an outdated Mac-style <code>\r</code>.</p>
<p dir="auto">So if you want to match 10 digits, a newline, 3 digits, a slash, 2 digits, a newline, and 3 digits, use <code>\d{10}\R\d{3}/\d{2}\R\d{3}</code><br />
-—</p>
<h3>Useful References</h3>
<ul>
<li><a href="https://community.notepad-plus-plus.org/topic/21965/please-read-before-posting">Please Read Before Posting</a></li>
<li><a href="https://community.notepad-plus-plus.org/topic/22022/template-for-search-replace-questions">Template for Search/Replace Questions</a></li>
<li><a href="https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regular-expressions-regex-documentation">FAQ: Where to find regular expressions (regex) documentation</a></li>
<li><a href="https://npp-user-manual.org/docs/searching/#regular-expressions" rel="nofollow ugc">Notepad++ Online User Manual: Searching/Regex</a></li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/71868</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71868</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sat, 04 Dec 2021 17:53:36 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Sat, 04 Dec 2021 10:57:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a></p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a></p>
<p dir="auto">Thanks Peter &amp; everyone for replying. [^\d]+ or \D+ worked perfectly. Even the output is coming as 1234567891|111|22|111|22|333|456|01010|8888899999. I can filter this and limit the characters, and it’s fine as make the final output as 1234567891|333|111|22.</p>
<p dir="auto">I was trying this regex to get \d{10}, and it selects all 10 digits, but I am not sure how to use it in multiline format. I tried this<br />
\d{10}<br />
\d{3}/\d{2}<br />
\d{3}<br />
or used \n for next line</p>
<p dir="auto">and it didn’t worked, obviously I made myself fool as am not aware about regex formats.</p>
<p dir="auto">But i am facing issue again, Suppose there are 3-4 alternative of example one (as per OP) , this regex (\D+), it combines all the letters in one row instead of separate rows like below</p>
<p dir="auto">1234567891|111|22|111|22|333|456|01010|8888899999|1234567891|111|22|111|22|333|456|01010|8888899999|1234567891|111|22|111|22|333|456|01010|8888899999</p>
<p dir="auto">If it can give me result like this<br />
1234567891|111|22|111|22|333|456|01010|8888899999<br />
1234567891|111|22|111|22|333|456|01010|8888899999<br />
1234567891|111|22|111|22|333|456|01010|8888899999</p>
<p dir="auto">I can filter it with character limits. any solution to keep rows</p>
<p dir="auto">I hope I am able to clarify my question this time. Love to everyone. :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71862</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71862</guid><dc:creator><![CDATA[gelle_marrisa]]></dc:creator><pubDate>Sat, 04 Dec 2021 10:57:05 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Tue, 30 Nov 2021 20:22:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> I agree that the problem statement is very confusing and incomplete. However, a ruleset that may be in play is:</p>
<p dir="auto">Extract 4 numbers from each record, as follows:</p>
<ol>
<li>the argument to the leading <em>aaaa</em> field, with the presence of the field name is optional</li>
<li>the argument to the <em>abcd</em> field, which optionally contains a second number which is extracted and used as the 3rd num</li>
<li>the argument to the <em>efgh</em> field, unless (it’s absent and) it was already extracted with <em>abcd</em></li>
<li>the argument to the <em>xyz</em> field</li>
</ol>
<p dir="auto">All other fields and their arguments are ignored.</p>
<p dir="auto">I’m not entirely sure it’s within my regex powers to provide a solution, although I imagine some other folk here would enjoy the challenge.</p>
<p dir="auto">In any case, I wouldn’t strain myself to try until <a class="plugin-mentions-user plugin-mentions-a" href="/user/gelle_marrisa" aria-label="Profile: gelle_marrisa">@<bdi>gelle_marrisa</bdi></a> makes an effort to clarify.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71729</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71729</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Tue, 30 Nov 2021 20:22:53 GMT</pubDate></item><item><title><![CDATA[Reply to How to find numbers in multiline in Notepad++ on Tue, 30 Nov 2021 14:08:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gelle_marrisa" aria-label="Profile: gelle_marrisa">@<bdi>gelle_marrisa</bdi></a> ,</p>
<p dir="auto">Your examples make no sense.  Your first example has the numbers 1234567891, 111, 22, 111, 22, 333, 456, 01010, 8888899999 … but your first example output line shows <code>1234567891|111|22|333</code>, so you seemingly randomly ignore certain numbers in your document without explaining how you’re supposed to tell which numbers to keep and which to skip.  And you also seem to prefer a certain order, without explaining how to change the original order into the desired order.</p>
<p dir="auto">That’s <em>not</em> a good way to ask a question.</p>
<p dir="auto">To get the simple version, without any guesses or randomly ignoring certain numbers, and without any reordering, you should just search for all stretches of one or more non-digit characters, and convert to a <code>|</code>.</p>
<p dir="auto">For example, FIND=<code>[^\d]+</code> or <code>\D+</code> (both mean the same thing), REPLACE=<code>|</code>, MODE=RegularExpression, will turn your first example into <code>1234567891|111|22|111|22|333|456|01010|8888899999</code>, your second example into <code>|1234567891|333|111|22|456|2|456|01010|8888899999</code>, and your third example into <code>|1234567891|333|111|22</code>.  If you don’t like the leading <code>|</code>, then after you’ve done that earlier replacement, search for FIND=<code>^\|</code>, REPLACE=empty, MODE=RegularExpression.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71719</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71719</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 30 Nov 2021 14:08:40 GMT</pubDate></item></channel></rss>