<?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[Find and replace line not starting with pattern and copy text from previous line]]></title><description><![CDATA[<p dir="auto">I have CSV text file which have Chat logs starting with “[” and after that it contains system date &amp; time, there are few lines which not starting with square brackets as chat user may have sent multiples line in that message. Now i want to find all those lines and copy the previous line date &amp; time with sender name in starting of that.</p>
<p dir="auto">how do I find lines not starting with “[” and than replace text from previous line user with  “[ ]” time stamp.</p>
<p dir="auto">Here is input and desired output file .</p>
<p dir="auto"><strong>INPUT</strong></p>
<p dir="auto">[25/11/19, 16:26:33] Roger: Not received mail<br />
[25/11/19, 16:27:04] Niks: Refresh<br />
[25/11/19, 16:28:12] Roger: Plz send again<br />
[25/11/19, 16:28:55] Niks: ok sent<br />
[25/11/19, 16:29:14] Roger: Received ok thanks<br />
[25/11/19, 16:29:38] Niks: 👍🏻<br />
‎[26/11/19, 13:20:31] Roger: ‎&lt;attached: 00000110-PHOTO-2019-11-26-13-20-31.jpg&gt;<br />
[26/11/19, 13:20:57] Roger: For 60000 units<br />
balance trf 59160<br />
[26/11/19, 13:30:55] Niks: Units Batch code<br />
SEGX-TWHB5Z	2500<br />
3CRD-QAMXD9	2500<br />
E4ZY-7HNK35	2500<br />
SGMV-FR4P5Y	2500<br />
[26/11/19, 13:32:55] Roger: Ok thanks</p>
<h2>============================================<br />
<strong>Output</strong>![alt text](image url)</h2>
<p dir="auto">[25/11/19, 16:26:33] Roger: Not received mail<br />
[25/11/19, 16:27:04] Niks: Refresh<br />
[25/11/19, 16:28:12] Roger: Plz send again<br />
[25/11/19, 16:28:55] Niks: ok sent<br />
[25/11/19, 16:29:14] Roger: Received ok thanks<br />
[25/11/19, 16:29:38] Niks: 👍🏻<br />
‎[26/11/19, 13:20:31] Roger: ‎&lt;attached: 00000110-PHOTO-2019-11-26-13-20-31.jpg&gt;<br />
[26/11/19, 13:20:57] Roger: For 60000 units<br />
[26/11/19, 13:20:57] Roger: balance trf 59160<br />
[26/11/19, 13:30:55] Niks: 	Units Batch code<br />
[26/11/19, 13:30:55] Niks: 	SEGX-TWHB5Z	2500<br />
[26/11/19, 13:30:55] Niks: 	3CRD-QAMXD9	2500<br />
[26/11/19, 13:30:55] Niks: 	E4ZY-7HNK35	2500<br />
[26/11/19, 13:30:55] Niks: 	SGMV-FR4P5Y	2500<br />
[26/11/19, 13:32:55] Roger: Ok thanks</p>
<p dir="auto">Finding lines in Yellow color &amp; replace with Orange text which is taken from previous lines.</p>
<p dir="auto">Thanks in advance<br />
<img src="/assets/uploads/files/1650896005883-1.png" alt="1.PNG" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/topic/22902/find-and-replace-line-not-starting-with-pattern-and-copy-text-from-previous-line</link><generator>RSS for Node</generator><lastBuildDate>Mon, 18 May 2026 18:55:06 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/22902.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 25 Apr 2022 14:13:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Sat, 26 Oct 2024 15:50:16 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/ahamed-nawas-ali" aria-label="Profile: ahamed-nawas-ali">@<bdi>ahamed-nawas-ali</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> and <strong>All</strong>,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ahamed-nawas-ali" aria-label="Profile: ahamed-nawas-ali">@<bdi>ahamed-nawas-ali</bdi></a>, I’ll use a <strong>similar</strong> search regex to the <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a>’s one !</p>
<hr />
<p dir="auto">For example , given this <em>INPUT</em> text , below :</p>
<pre><code class="language-diff">2021-09-14T21:10:55+00:00	ATX	Field3	Guy	Field5	Learning
Selection
B. Home
Webinar 
IDB
20214980
2021420214202216
2021-09-15T11:19:14+00:00	BYQ	Field3	Alan	Field5	Test
B. Home
Webinar 
IDB
20214980
2021-09-16T15:07:46+00:00	ATX	Field3	Peter	Field5	Try
Selection
B. Home
Webinar 
IDB
20214980
2021420214202216
Blablah
OK
END of story
</code></pre>
<ul>
<li>
<p dir="auto">Open the <strong>Replace</strong> dialog ( <strong><code>Ctrl+H</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong>Uncheck</strong> all <strong>box</strong> options</p>
</li>
<li>
<p dir="auto">Search <strong><code>(?-s)^(\d{4}-.+\t).+\R\K(?!\d{4}-|\R|\z)</code></strong></p>
</li>
<li>
<p dir="auto">Replace <strong><code>$1</code></strong></p>
</li>
<li>
<p dir="auto">If necessary, check the <strong><code>Wrap around</code></strong> option</p>
</li>
<li>
<p dir="auto">Select the <strong><code>Regular expression</code></strong> search mode</p>
</li>
<li>
<p dir="auto">Click, <strong>exclusively</strong>, on the <strong><code>Replace All</code></strong> button, <strong>several</strong> times, till the message <strong><code>Replace All: 0 occurrences were replaced...</code></strong> is displayed !</p>
</li>
</ul>
<p dir="auto">At the <strong>end</strong>, you should get this <strong>expected</strong> <em>OUTPUT</em> text :</p>
<pre><code class="language-diff">2021-09-14T21:10:55+00:00	ATX	Field3	Guy	Field5	Learning
2021-09-14T21:10:55+00:00	ATX	Field3	Guy	Field5	Selection
2021-09-14T21:10:55+00:00	ATX	Field3	Guy	Field5	B. Home
2021-09-14T21:10:55+00:00	ATX	Field3	Guy	Field5	Webinar 
2021-09-14T21:10:55+00:00	ATX	Field3	Guy	Field5	IDB
2021-09-14T21:10:55+00:00	ATX	Field3	Guy	Field5	20214980
2021-09-14T21:10:55+00:00	ATX	Field3	Guy	Field5	2021420214202216
2021-09-15T11:19:14+00:00	BYQ	Field3	Alan	Field5	Test
2021-09-15T11:19:14+00:00	BYQ	Field3	Alan	Field5	B. Home
2021-09-15T11:19:14+00:00	BYQ	Field3	Alan	Field5	Webinar 
2021-09-15T11:19:14+00:00	BYQ	Field3	Alan	Field5	IDB
2021-09-15T11:19:14+00:00	BYQ	Field3	Alan	Field5	20214980
2021-09-16T15:07:46+00:00	ATX	Field3	Peter	Field5	Try
2021-09-16T15:07:46+00:00	ATX	Field3	Peter	Field5	Selection
2021-09-16T15:07:46+00:00	ATX	Field3	Peter	Field5	B. Home
2021-09-16T15:07:46+00:00	ATX	Field3	Peter	Field5	Webinar 
2021-09-16T15:07:46+00:00	ATX	Field3	Peter	Field5	IDB
2021-09-16T15:07:46+00:00	ATX	Field3	Peter	Field5	20214980
2021-09-16T15:07:46+00:00	ATX	Field3	Peter	Field5	2021420214202216
2021-09-16T15:07:46+00:00	ATX	Field3	Peter	Field5	Blablah
2021-09-16T15:07:46+00:00	ATX	Field3	Peter	Field5	OK
2021-09-16T15:07:46+00:00	ATX	Field3	Peter	Field5	END of story
</code></pre>
<p dir="auto">Voila :-))</p>
<hr />
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">As you can see, the number of <strong>columns</strong>, before the <strong>last</strong> one, is <strong>not</strong> a problem !</p>
</li>
<li>
<p dir="auto">From <strong>beginning</strong> of line ( <strong><code>^</code></strong> ), the regex looks for a line beginning with <strong><code>4</code></strong>  <strong>digits</strong>, followed with a <strong>dash</strong> character (<strong><code>\d{4}-</code></strong> ) and anything else till the last tabulation ( <strong><code>.+\t</code></strong> ) of current line</p>
</li>
<li>
<p dir="auto">This search, so far, is memorized and stored as <strong>group</strong> <strong><code>1</code></strong></p>
</li>
<li>
<p dir="auto">After the <strong>last</strong> field of the line and the line-break ( <strong><code>.+\R</code></strong> ), all the <strong>matched</strong> string is <strong>discarded</strong> ( <strong><code>\K</code></strong> )</p>
</li>
<li>
<p dir="auto">Thus, the <strong>regex</strong> engine is now searching for a <strong>zero-length</strong> string, at beginning of the <strong>next</strong> line, but <em>ONLY IF</em> this next line does <strong>not</strong> begin with :</p>
<ul>
<li>
<p dir="auto"><strong><code>4</code></strong> <strong>digits</strong> and a <strong>dash</strong> char</p>
</li>
<li>
<p dir="auto">An other <strong>line-break</strong></p>
</li>
<li>
<p dir="auto">The <strong>very end</strong> of current file</p>
</li>
</ul>
</li>
<li>
<p dir="auto">When this assertion is <strong>true</strong>, it just inserts the <strong>group</strong> <strong><code>1</code></strong> contents at the <strong>very beginning</strong> of current line</p>
</li>
</ul>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">If the condition to detect the <strong>header</strong> lines seems <strong>not restrictive</strong> enough, you may use this <strong>alternate</strong> search regex :</p>
<ul>
<li>Search <strong><code>(?-is)^(20\d\d-\d\d-\d\dT.+\t).+\R\K(?!20\d\d-\d\d-\d\dT|\R|\z)</code></strong></li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/97349</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97349</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 26 Oct 2024 15:50:16 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Sat, 26 Oct 2024 13:13:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> Sorry Alan! I know i am wrong with that “\n([^2021-])” as it will spoil my delimiter as well and there could be some other issues as well. Its true that one can’t learn Regex in a hurry! I am using yours snippet and thank you for that!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97346</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97346</guid><dc:creator><![CDATA[Ahamed Nawas Ali]]></dc:creator><pubDate>Sat, 26 Oct 2024 13:13:55 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Sat, 26 Oct 2024 11:03:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ahamed-nawas-ali" aria-label="Profile: Ahamed-Nawas-Ali">@<bdi>Ahamed-Nawas-Ali</bdi></a> said:</p>
<blockquote>
<p dir="auto"><code>\n([^2021-])</code></p>
</blockquote>
<p dir="auto">That’s totally wrong for what you’re wanting… in several ways…<br />
But since you seem to be in a hurry…and you can’t reasonably do anything with regex in a hurry…I won’t explain and I’ll just wish you good luck.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97345</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97345</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 26 Oct 2024 11:03:03 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Sat, 26 Oct 2024 10:54:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> I tried with below in order to keep clicking on the buttons to replace everything and it worked in removing the line numbers however the strings are concatenated.</p>
<p dir="auto">Find box: \n([^2021-])<br />
Replace box: $1</p>
<p dir="auto">Result:</p>
<pre><code>2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	LearningSelectionB. HomeWebinar IDB20214980202216
2021-09-15T11:19:14+00:00	Ahamed Ali	Nawas	Thanks!
</code></pre>
<p dir="auto">And the results are messed up a bit. Anyway, thank you so much for the time stamp line leader and for now, i will have to use it anyway to avoid further delay in my project! Thanks <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> &amp; <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> for your guidance! Greatly appreciate your guidance to this community! God bless you all!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97343</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97343</guid><dc:creator><![CDATA[Ahamed Nawas Ali]]></dc:creator><pubDate>Sat, 26 Oct 2024 10:54:22 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Sat, 26 Oct 2024 10:22:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ahamed-nawas-ali" aria-label="Profile: Ahamed-Nawas-Ali">@<bdi>Ahamed-Nawas-Ali</bdi></a> said :</p>
<blockquote>
<p dir="auto">Example scenario i am dealing with is with Date_Time Sender Recepients Message delimited with ‘Tab’</p>
</blockquote>
<p dir="auto">For this one, I considered the following to be enough to distinguish a timestamp line leader:  <code>2021-09-15T</code></p>
<p dir="auto">Thus I tried (based upon <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>’s solution earlier in this thread):</p>
<p dir="auto">Find: <code>(?-s)^(\d{4}-\d\d-\d\dT.+\t).+\R\K(?!\d{4}-\d\d-\d\dT)</code><br />
Replace: <code>${1}</code><br />
Options: <em>Wrap around</em>, <em>Regular expression</em><br />
Action: <em>Replace All</em> (multiple times, until no more changes occur)</p>
<p dir="auto">And after several <em>Replace All</em> presses, I obtained the following:</p>
<pre><code class="language-txt">2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	Learning
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	Selection
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	B. Home
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	Webinar 
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	IDB
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	20214980
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	202216
2021-09-15T11:19:14+00:00	Ahamed Ali	Nawas	Thanks!
2021-09-15T11:19:14+00:00	Ahamed Ali	Nawas	
</code></pre>
<p dir="auto">Note that the last line of this output is “extra” and should be manually removed.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97340</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97340</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 26 Oct 2024 10:22:34 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Sat, 26 Oct 2024 07:22:30 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>, Thanks for your reply. I am sorry, I am new to this platform.</p>
<p dir="auto">Example scenario i am dealing with is with Date_Time Sender Recepients Message delimited with ‘Tab’</p>
<pre><code>2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	Learning
Selection
B. Home
Webinar 
IDB
20214980
202216
2021-09-15T11:19:14+00:00	Ahamed Ali	Nawas	Thanks!
</code></pre>
<p dir="auto">And i should make it like below</p>
<pre><code>2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	Learning
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	Selection
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	B. Home
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	Webinar 
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	IDB
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	20214980
2021-09-14T21:10:55+00:00	Nawas	Ram Kumar,Ahamed Ali	202216
2021-09-15T11:19:14+00:00	Ahamed Ali	Nawas	Thanks!
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/97339</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97339</guid><dc:creator><![CDATA[Ahamed Nawas Ali]]></dc:creator><pubDate>Sat, 26 Oct 2024 07:22:30 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Fri, 25 Oct 2024 18:39:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ahamed-nawas-ali" aria-label="Profile: Ahamed-Nawas-Ali">@<bdi>Ahamed-Nawas-Ali</bdi></a> said in <a href="/post/97326">Find and replace line not starting with pattern and copy text from previous line</a>:</p>
<blockquote>
<p dir="auto">is there any shorter way?</p>
</blockquote>
<p dir="auto">The way described above is reasonably short.  I am not sure what “improvement” you think is necessary (or even possible).</p>
<blockquote>
<p dir="auto">is there any way we can unmark the line number for those identified lines which does not start with a pattern.</p>
</blockquote>
<p dir="auto">Sorry, I don’t understand how that’s different than the original question.</p>
<p dir="auto">You’ll have to give a better example – use the <code>&lt;/&gt;</code> button on the toolbar when you are writing the post to create pairs of ```, between which you can paste your actual data:, something like</p>
<pre><code>**data I have**:
```
[1234] abcxyz
next line
[5678] pdq
aonther
```

**desired data after transformation**
```
[1234] abcxyz
[1234] next line
[5678] pdq
[5678] aonther
```
</code></pre>
<p dir="auto">…<br />
This would be rendered as the following, so we know exactly what your “before” and “after” data needs to be.<br />
-–<br />
<strong>data I have</strong>:</p>
<pre><code>[1234] abcxyz
next line
[5678] pdq
aonther
</code></pre>
<p dir="auto"><strong>desired data after transformation</strong></p>
<pre><code>[1234] abcxyz
[1234] next line
[5678] pdq
[5678] aonther
</code></pre>
<p dir="auto">-—</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/21925/faq-desk-formatting-forum-posts">Formatting Forum Posts</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>
<li><a href="https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regular-expressions-regex-documentation">FAQ: Where to find other regular expressions (regex) documentation</a></li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/97327</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97327</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 25 Oct 2024 18:39:07 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Fri, 25 Oct 2024 18:09:09 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 have a similar scenario where i have 10K lines i need to fix, is there any shorter way? Also, is there any way we can unmark the line number for those identified lines which does not start with a pattern.</p>
<p dir="auto">Example: My line number starts with datetime (2021-09-14T21:10:55+00:00)</p>
<p dir="auto">And can i make all these lines which does not start with “2021-” without line numbers provided by notepad++?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97326</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97326</guid><dc:creator><![CDATA[Ahamed Nawas Ali]]></dc:creator><pubDate>Fri, 25 Oct 2024 18:09:09 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Tue, 26 Apr 2022 12:05:40 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/76352">Find and replace line not starting with pattern and copy text from previous line</a>:</p>
<blockquote>
<p dir="auto">Alan, … you created a Python script to make all these fancy Unicode format characters clearly visible</p>
</blockquote>
<p dir="auto">Well, yes, I did.  :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/76364</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/76364</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 26 Apr 2022 12:05:40 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Tue, 26 Apr 2022 17:00:32 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/nitin-jain" aria-label="Profile: nitin-jain">@<bdi>nitin-jain</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">Ah ah ! <strong>Alan</strong>, I, first, didn’t understand why you had the <strong>LRM</strong> sigle in the <strong>second</strong> line of my text. My second thought was that you created a <strong>Python</strong> script to make all these fancy <strong>Unicode format</strong> characters clearly <strong>visible</strong> ! But, luckily, marking any <strong><code>\x{200e}</code></strong> character did the trick and showed me a <strong>thin red</strong> mark when this <strong>special</strong> char is present !</p>
<hr />
<p dir="auto">So, <a class="plugin-mentions-user plugin-mentions-a" href="/user/nitin-jain" aria-label="Profile: nitin-jain">@<bdi>nitin-jain</bdi></a>, as <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> said, use this simple <strong>regex</strong> S/R, below, to get rid of these <strong>format</strong> characters !</p>
<p dir="auto">SEARCH  <strong><code>[\x{200B}-\x{200F}\x{202A}-\x{202F}]</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
<p dir="auto">However, <strong>verify</strong> that this operation does <strong>not</strong> break down your text in any way ! I personally saw this case, while pasting <strong>Unicode</strong> characters from a long list, produced by this <strong>excellent</strong> and valuable site, regarding <strong>Unicode</strong> :</p>
<p dir="auto"><a href="https://r12a.github.io/uniview/" rel="nofollow ugc">https://r12a.github.io/uniview/</a></p>
<hr />
<p dir="auto">Now, I’m pleased to note that there is <strong>no</strong> bug of our <strong><code>Boost</code></strong> regex engine, in this matter, as that special <strong><code>LRM</code></strong> char is quite a character <strong>different</strong> from a <strong><code>[</code></strong> symbol !</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/76352</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/76352</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 26 Apr 2022 17:00:32 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Mon, 25 Apr 2022 18:41:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> said in <a href="/post/76331">Find and replace line not starting with pattern and copy text from previous line</a>:</p>
<blockquote>
<p dir="auto">there is an LRM in it, which seems to cause your erroneous match!</p>
</blockquote>
<p dir="auto">Indeed. I was originally going to ask Guy why my regex wasn’t working with the supplied data (the same question Guy asked us), when I happened to left arrow from the <code>[</code> and stayed on that same line!  That told me there was a hidden character, which is why I ran the reveal-hidden-characters script from the <a href="https://community.notepad-plus-plus.org/topic/14045/invisible-characters-unwanted/19">old conversation</a>, and I saw the infamous LRM – which is why I added the paragraph to tell <a class="plugin-mentions-user plugin-mentions-a" href="/user/nitin-jain" aria-label="Profile: nitin-jain">@<bdi>nitin-jain</bdi></a> to do the zero-width search/replace before doing the main search/replace.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/76337</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/76337</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 25 Apr 2022 18:41:18 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Mon, 25 Apr 2022 16:58:07 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/76330">Find and replace line not starting with pattern and copy text from previous line</a>:</p>
<blockquote>
<p dir="auto">But, unfortunately, it also matches the first line []xyz ???<br />
Am I wrong in any way, in this matter ?</p>
</blockquote>
<p dir="auto">When I copy -n-paste your black box data, there is an LRM in it, which seems to cause your erroneous match!</p>
<p dir="auto"><img src="/assets/uploads/files/1650905884154-07559618-c16f-4265-94b8-6f9f5f27d0d1-image.png" alt="07559618-c16f-4265-94b8-6f9f5f27d0d1-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/76331</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/76331</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 25 Apr 2022 16:58:07 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Mon, 25 Apr 2022 16:45:22 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <strong>all</strong>,</p>
<p dir="auto">I suppose I find out a <strong>bug</strong>, in our <strong><code>Boost</code></strong> regex engine !</p>
<p dir="auto">Let’s take this simple <strong>example</strong> tet :</p>
<pre><code class="language-diff">[]xyz
‎[]xyz
[]xyz
ABC
[]xyz
DEF
</code></pre>
<p dir="auto">Now, the <strong>four</strong> regexes below, should look for the <strong>literal</strong> string <strong><code>[]</code></strong> beginning a line, followed with any <strong>non-null</strong> string and its <strong>line-ending</strong> chars, <em>ONLY IF</em> not followed with a leading <strong><code>[</code></strong> symbol !</p>
<p dir="auto"><strong><code>(?-s)^\\[\\].+\R(?!\\[)</code></strong></p>
<p dir="auto"><strong><code>(?-s)^\\[\\].+\r\n(?!\\[)</code></strong></p>
<p dir="auto"><strong><code>(?-s)^\x5b\x5d.+\R(?!\x5b)</code></strong></p>
<p dir="auto"><strong><code>(?-s)^\x5b\x5d.+\r\n(?!\x5b)</code></strong></p>
<hr />
<p dir="auto">Thus, it should <strong>only</strong> match the <strong>txo</strong> lines, below :</p>
<ul>
<li>
<p dir="auto">The <strong><code>[]xyz</code></strong> line <strong>before</strong> the string <strong><code>ABC</code></strong></p>
</li>
<li>
<p dir="auto">The <strong><code>[]xyz</code></strong> line <strong>before</strong> the string <strong><code>DEF</code></strong></p>
</li>
</ul>
<p dir="auto">But, <strong>unfortunately</strong>, it also matches the <strong>first</strong> line <strong><code>[]xyz</code></strong> ???</p>
<p dir="auto">Am I <strong>wrong</strong> in any way, in this matter ?</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/76330</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/76330</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 25 Apr 2022 16:45:22 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Mon, 25 Apr 2022 16:25:42 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/nitin-jain" aria-label="Profile: nitin-jain">@<bdi>nitin-jain</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">Oh… <strong>Peter</strong> beats me at it ! Here is my solution, quite <strong>similar</strong> !</p>
<p dir="auto">If you are sure that all the <strong>dates</strong> are in <strong>increasing</strong> order, simply use the following regex S/R :</p>
<ul>
<li>
<p dir="auto">Open the <strong>Replace</strong> dialog ( <strong><code>Ctrl + H</code></strong> )</p>
</li>
<li>
<p dir="auto">SEARCH <strong><code>(?-s)^(\[.+\]).+\R\K(?=\w)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>\1$0\x20</code></strong></p>
</li>
<li>
<p dir="auto">Tick the <strong><code>Wrap around</code></strong> option</p>
</li>
<li>
<p dir="auto">Select  the <strong><code>Regular repression</code></strong> search <strong>mode</strong></p>
</li>
<li>
<p dir="auto">Click <strong>several</strong> times on the <strong><code>Replace All</code></strong> button, till you see the message <strong><code>0 occurrences were replaced in entire file</code></strong></p>
</li>
</ul>
<p dir="auto">So, from the <em>INPUT</em> text :</p>
<pre><code class="language-diff">[25/11/19, 16:26:33] Roger: Not received mail
[25/11/19, 16:27:04] Niks: Refresh
[25/11/19, 16:28:12] Roger: Plz send again
[25/11/19, 16:28:55] Niks: ok sent
[25/11/19, 16:29:14] Roger: Received ok thanks
[25/11/19, 16:29:38] Niks: 👍🏻
‎[26/11/19, 13:20:31] Roger: ‎&lt;attached: 00000110-PHOTO-2019-11-26-13-20-31.jpg&gt;
[26/11/19, 13:20:57] Roger: For 60000 units
balance trf 59160
[26/11/19, 13:30:55] Niks: Units Batch code
SEGX-TWHB5Z 2500
3CRD-QAMXD9 2500
E4ZY-7HNK35 2500
SGMV-FR4P5Y 2500
[26/11/19, 13:32:55] Roger: Ok thanks
</code></pre>
<p dir="auto">you’ll get the <strong>expected</strong> <em>OUTPUT</em> result :</p>
<pre><code class="language-diff">[25/11/19, 16:26:33] Roger: Not received mail
[25/11/19, 16:27:04] Niks: Refresh
[25/11/19, 16:28:12] Roger: Plz send again
[25/11/19, 16:28:55] Niks: ok sent
[25/11/19, 16:29:14] Roger: Received ok thanks
[25/11/19, 16:29:38] Niks: 👍🏻
‎[26/11/19, 13:20:31] Roger: ‎&lt;attached: 00000110-PHOTO-2019-11-26-13-20-31.jpg&gt;
[26/11/19, 13:20:57] Roger: For 60000 units
[26/11/19, 13:20:57] balance trf 59160
[26/11/19, 13:30:55] Niks: Units Batch code
[26/11/19, 13:30:55] SEGX-TWHB5Z 2500
[26/11/19, 13:30:55] 3CRD-QAMXD9 2500
[26/11/19, 13:30:55] E4ZY-7HNK35 2500
[26/11/19, 13:30:55] SGMV-FR4P5Y 2500
[26/11/19, 13:32:55] Roger: Ok thanks
</code></pre>
<p dir="auto">Best regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/76328</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/76328</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 25 Apr 2022 16:25:42 GMT</pubDate></item><item><title><![CDATA[Reply to Find and replace line not starting with pattern and copy text from previous line on Mon, 25 Apr 2022 15:04:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nitin-jain" aria-label="Profile: nitin-jain">@<bdi>nitin-jain</bdi></a> ,</p>
<p dir="auto">I came up with something that mostly works, except for on the line after the 👍🏻.  I haven’t figured out why that is messing up my regex:</p>
<ul>
<li>FIND = <code>(?-s)^(\x5B.*?\x5D.*?:\h*).*$\R\K(?!\x5B)</code></li>
<li>REPLACE = <code>$1</code></li>
<li>SEARCH MODE = regular expression</li>
<li>REPLACE ALL multiple times, until it’s really all done</li>
</ul>
<p dir="auto">The line after the thumbs-up has difficulty because, as <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> found <a href="https://community.notepad-plus-plus.org/topic/14045/invisible-characters-unwanted/19">a couple years back</a>, such chat logs will occasionally have the U+200E LEFT-TO-RIGHT MARK peppered throughout… and that photo line contains two instances.  So before running the regex I showed, also replace <code>\x{200E}</code> with empty … or I’d suggest <code>[\x{200B}-\x{200F}\x{202A}-\x{202F}]</code> with empty (which will get rid of other zero-width characters).</p>
<p dir="auto">So run the zero-width replacement first, then REPLACE ALL multiple times on the first one I shared until all the lines have that.  (If your longest block is four lines that don’t start with <code>[</code>, you will have to REPLACE ALL four times)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/76322</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/76322</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 25 Apr 2022 15:04:50 GMT</pubDate></item></channel></rss>