<?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 do I replace only the first &lt;br&gt; tag across multiple files?]]></title><description><![CDATA[<p dir="auto">I have some blocks of text in multiple files. As an example, here is one such block (these blocks have different content in each file but all have the &lt;br&gt; tags):-</p>
<pre><code>&lt;p class=MsoNormal style='margin-bottom:12.0pt;line-height:normal'&gt;&lt;span
    style='font-size:13.5pt;font-family:"Verdana","sans-serif";mso-fareast-font-family:
    "Times New Roman";mso-bidi-font-family:"Times New Roman";color:black'&gt;-Mucous
    membranes are inflamed and ulcerated, causing mucopurulent discharges and
    splinter-like pains. Violent pains like deeply sticking SPLINTER or sharp,
    shooting, like lightning, grinding or radiating, causing starting,
    extending down the back or legs. &lt;br&gt;
    &lt;br&gt;
    -Chilly when uncovered yet feels smothered if wrapped up. Craves fresh air.
    &lt;br&gt;
    &lt;br&gt;
    -Symptoms of INCOORDINATION, loss of control and want of balance everywhere
    mentally and physically. Trembling in affected parts. &lt;br&gt;
    &lt;br&gt;
    -Desire for SUGAR, sweets, salt; but sugar &amp;lt;, it results in diarrhoea. &lt;br&gt;
    &lt;br&gt;
    -Warm blooded, one of the hottest remedies. &lt;br&gt;
    &lt;br&gt;
    -Headache - with coldness and trembling. &lt;br&gt;
    &lt;br&gt;
    -Congestive, with fullness and heaviness, with sense of expansion. &lt;br&gt;
    &lt;br&gt;
    -Habitual, gastric, ending in bilious vomiting. &lt;br&gt;
    &lt;br&gt;
    - &amp;lt; from mental labour; &amp;gt;pressure or tight bandaging (Apis, Puls). &lt;br&gt;
    &lt;br&gt;
    -Eyes&lt;/span&gt;&lt;/p&gt;
</code></pre>
<p dir="auto">How do I replace only the first &lt;br&gt; tag across multiple files (that is, the first &lt;br&gt; tag in each file)?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/21560/how-do-i-replace-only-the-first-br-tag-across-multiple-files</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 01:04:55 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/21560.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 27 Jul 2021 05:43:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Sat, 07 Aug 2021 13:02:16 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@scott-nielson</a> and <strong>All</strong>,</p>
<p dir="auto">A bit <strong>off-topic</strong> : Yeah, it’s a <strong>common</strong> mistake when doing translations ! In <strong>French</strong>, this kind of words are known as “<em>faux amis</em>” words ! Just because :</p>
<ul>
<li>
<p dir="auto">In <strong>English</strong>, the adjective <strong><code>sensible</code></strong> have the <strong>French</strong> sense of <strong><code>raisonnable</code></strong> / <strong><code>sensé</code></strong> or <strong><code>pratique</code></strong></p>
</li>
<li>
<p dir="auto">In <strong>French</strong> the adjective <strong><code>sensible</code></strong> have the <strong>English</strong> sense of <strong><code>sensitive</code></strong> or <strong><code>noticable</code></strong></p>
</li>
</ul>
<p dir="auto">So, I should have used the expression <strong><code>sensitive to case</code></strong> !</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68680</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68680</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 07 Aug 2021 13:02:16 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 03 Aug 2021 11:31:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> If you give me a link to check out something or give me a hint, I do check it out but luckily, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> gave me the right solution (spoon feeding as you call it)!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68526</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68526</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Tue, 03 Aug 2021 11:31:25 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 03 Aug 2021 11:19:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a><br />
<a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@Scott-Nielson</a> said in <a href="/post/68473">How do I replace only the first &lt;br&gt; tag across multiple files?</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> or anyone else. I am doing Edit-&gt;Line Operations-&gt;Reverse line order, then in the RegEx mode,<br />
Find: <code>^[^/]+\K&lt;br&gt;</code> to find the last (which is actually the first since the lines are reversed) <code>&lt;br&gt;</code> tag in each section and Replace: <code>&lt;br&gt;zxcvb</code>,<br />
Then Find: <code>(?s)(?&lt;=color:black'&gt;)-(.*?) *(?=zxcvb)</code> and Replace: <code>qwerty$1xxx</code> where qwerty and xxx are some HTML codes I wanna add but is there a RegEx that can help me do the needful without the Edit-&gt;Line Operations-&gt;Reverse line order (to find the first <code>&lt;br&gt;</code> tag in each section)?</p>
</blockquote>
<p dir="auto">By the above, you should have figured out that I do try to figure out how to do these things. <code>I seek a solution here only if I am unable to figure out what to do and will continue to do so - I ain't too proud to beg.</code> I thank you for the RegEx that helped me find the very first <code>&lt;br&gt;</code> tag - <code>(?s)\A.*?\K&lt;br&gt;</code><br />
Thanks again!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68525</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68525</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Tue, 03 Aug 2021 11:19:12 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 03 Aug 2021 10:55:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a> No problem!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68524</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68524</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Tue, 03 Aug 2021 10:55:48 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 03 Aug 2021 10:41:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> Terrific! You are great! I was sensible enough to figure out that by, “<code>sensible to case</code>” you mean, “<code>case sensitive</code>” and by, “<code>The $0 syntax represents the overall match, so the string &lt;br&gt;, with this exact case</code>” you mean, “<code>The $0 syntax represents the overall match, which is the string &lt;br&gt;, with this exact case</code>”. You must be French. <code>Merci beaucoup</code> for your help! I learnt French some 30 years ago but <code>je ne peux pas parler beaucoup de français</code> simply because I seldom bumped into French speaking people later.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68523</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68523</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Tue, 03 Aug 2021 10:41:57 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 03 Aug 2021 01:46:29 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@scott-nielson</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@peterjones</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@terry-r</a> and <strong>All</strong>,</p>
<p dir="auto">Why not this S/R :</p>
<p dir="auto"><em>SEARCH</em> <strong><code>(?s-i)&lt;p.*?&gt;&lt;span.+?\K&lt;br&gt;</code></strong></p>
<p dir="auto"><em>REPLACE</em> <strong><code>zxcvb$0</code></strong></p>
<p dir="auto">As usual, <strong><code>Regular expression</code></strong> mode, <strong><code>Wrap around</code></strong> option and just <strong><code>1</code></strong> click on the <strong><code>Replace All</code></strong> button ( Do <strong>not</strong> use the <strong><code>Replace</code></strong> button, due to the <strong><code>\K</code></strong> syntax ! )</p>
<hr />
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">In <em>SEARCH</em> :</p>
<ul>
<li>
<p dir="auto">First, the <strong><code>(?s-i)</code></strong> syntax are in-line <strong>modifiers</strong> which means that :</p>
<ul>
<li>
<p dir="auto">The <strong>regex</strong> dot char <strong><code>.</code></strong> matches any <strong>single</strong> character, even <strong>EOL</strong> ones, allowing <strong>multi-lines</strong> search</p>
</li>
<li>
<p dir="auto">The search is <strong>sensible</strong> to case ( <strong>not</strong> insensible ! )</p>
</li>
</ul>
</li>
<li>
<p dir="auto">The <strong><code>.*?</code></strong> and <strong><code>.+?</code></strong> syntaxes represent, respectively, the <strong>shortest</strong>, possibly <strong>null</strong>, range of chars between the <strong><code>&lt;p</code></strong> and <strong><code>&gt;&lt;span</code></strong> strings and the <strong>shortest non-null</strong> range of chars between the <strong><code>&gt;&lt;span</code></strong> and <strong>first</strong> <strong><code>&lt;br&gt;</code></strong> strings</p>
</li>
<li>
<p dir="auto">Then, the <strong><code>\K</code></strong> feature <strong>resets</strong> the present match. So, the <strong>final</strong> match is just the <strong><code>&lt;br&gt;</code></strong> tag</p>
</li>
</ul>
</li>
<li>
<p dir="auto">In <em>REPLACEMENT</em> :</p>
<ul>
<li>The <strong><code>$0</code></strong> syntax represents the <strong>overall</strong> match, so the string <strong><code>&lt;br&gt;</code></strong>, with this <strong>exact</strong> case</li>
</ul>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68520</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68520</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 03 Aug 2021 01:46:29 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Mon, 02 Aug 2021 20:54:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> said in <a href="/post/68516">How do I replace only the first &lt;br&gt; tag across multiple files?</a>:</p>
<blockquote>
<p dir="auto">Technically, it wasn’t just a repeat.  The text in the “replace with” changed from &lt;br&gt;zxcvb to zxcvb&lt;br&gt; in multiple locations.  I think the OP said “sorry” because he got the data wrong.</p>
</blockquote>
<p dir="auto">So apologies to <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@Scott-Nielson</a> , I did check the “before” text which was exactly the same, so assumed the “after” would also be.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> we seem to have an influx of OPs whose posts are very sparsely populated. Meaning bugger all text! I’ve given up trying to intepret some of the posts, and I wonder why you still persist. Maybe you need another boilerplate answer (or expand the current one, which is getting bigger by the day?) to say “please expand on your question or else you will get limited/no responses”.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68517</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68517</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 02 Aug 2021 20:54:33 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Mon, 02 Aug 2021 20:49:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a> said in <a href="/post/68514">How do I replace only the first &lt;br&gt; tag across multiple files?</a>:</p>
<blockquote>
<p dir="auto">Repeating your request</p>
</blockquote>
<p dir="auto">Technically, it wasn’t just a repeat.  The text in the “replace with” changed from <code>&lt;br&gt;zxcvb</code> to <code>zxcvb&lt;br&gt;</code> in multiple locations.  I think the OP said “sorry” because he got the data wrong.</p>
<p dir="auto">Unfortunately, due to the historic manner in which this user “asks” for things, it was not unreasonable for you to assume that the OP was just being impatient.  That’s too bad, when a slight change of phrasing, and more of a willingness to do the work themselves, would make a drastic improvement in that user’s questions.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@Scott-Nielson</a> ,</p>
<p dir="auto">For the problem at hand, if Guy doesn’t have a chance to solve it for you right away, I highly recommend you should look at the generic regular expression for finding text between two keywords that Guy details <a href="https://community.notepad-plus-plus.org/post/62799">here</a>, which would solve the “for each section” part of the question; and maybe doing a search for “<a href="https://community.notepad-plus-plus.org/search?term=find%20last&amp;in=posts&amp;matchWords=all&amp;sortBy=timestamp&amp;sortDirection=desc&amp;showAs=posts">find last</a>” in the forum, which would solve the “find the last <code>&lt;br&gt;</code>” part of the question.  Combining the “find the last” with “for each section” would give you all that you need in order to figure it out on your own.  And doing so would greatly benefit you, both in personal learning and showing us that you are willing to learn.</p>
<p dir="auto">I’ll give my generic advice again.  Maybe you will read and understand it this time, and will start reading the pages linked</p>
<p dir="auto">----</p>
<p dir="auto"><em><strong>Please note</strong>: This Community Forum is not a data transformation service; you should not expect to be able to always say “I have data like X and want it to look like Y” and have us do all the work for you.  If you are new to the Forum, and new to regular expressions, we will often give help on the first one or two data-transformation questions, especially if they are well-asked and you show a willingness to learn; and we will point you to the documentation where you can learn how to do the data transformations for yourself in the future.  But if you repeatedly ask us to do your work for you, you will find that the patience of usually-helpful Community members wears thin.  The best way to learn regular expressions is by experimenting with them yourself, and getting a feel for how they work; having us spoon-feed you the answers without you putting in the effort doesn’t help you in the long term and is uninteresting and annoying for us.</em></p>
<p dir="auto">----</p>
<p dir="auto"><em>Do you want regex search/replace help?  Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you.  All example text should be marked as literal text using the <code>&lt;/&gt;</code> toolbar button or manual <a href="https://community.notepad-plus-plus.org/topic/14262/how-to-markdown-code-on-this-forum/4">Markdown syntax</a>. To make <code>regex in red</code> (and so they keep their special characters like *), use backticks, like <code>`^.*?blah.*?\z`</code>. Screenshots can be pasted from the clipboard to your post using <code>Ctrl+V</code> to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have <strong>and</strong> the text you want to get from that data; include examples of things that <strong>should match</strong> and be transformed, <strong>and</strong> things that <strong>don’t match</strong> and should be left alone; show <strong>edge cases</strong> and make sure you examples are as <strong>varied</strong> as your real data.  Show the regex you already tried, <strong>and why</strong> you thought it should work; tell us what’s wrong with what you <strong>do</strong> get. Read the official <a href="https://npp-user-manual.org/docs/searching/#regular-expressions" rel="nofollow ugc">NPP Searching / Regex docs</a> and the forum’s <a href="https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regex-documentation">Regular Expression FAQ</a>. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.</em></p>
]]></description><link>https://community.notepad-plus-plus.org/post/68516</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68516</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 02 Aug 2021 20:49:27 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Mon, 02 Aug 2021 20:20:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@Scott-Nielson</a> said in <a href="/post/68511">How do I replace only the first &lt;br&gt; tag across multiple files?</a>:</p>
<blockquote>
<p dir="auto">I want this block of text:-</p>
</blockquote>
<p dir="auto">Repeating your request isn’t going to get <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> to respond any faster. We here on the forum give our time freely, to help others. We aren’t tied to the forum 24hrs a day, we mostly have real jobs that pay.</p>
<p dir="auto">So just wait and since <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> has offered to help you he will, just allow him time to do so. Patience is a virtue!</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68514</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68514</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 02 Aug 2021 20:20:19 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Mon, 02 Aug 2021 19:55:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> Sorry RegEx Guru, I want this block of text:-</p>
<pre><code>&lt;p class=MsoNormal style='margin-bottom:12.0pt;line-height:normal'&gt;&lt;span
  style='font-size:13.5pt;font-family:"Verdana","sans-serif";mso-fareast-font-family:
  "Times New Roman";mso-bidi-font-family:"Times New Roman";color:black;
  mso-ansi-language:EN-US'&gt;-Self-conscious. SELFISH. Egotism. &lt;br&gt;
  &lt;br&gt;
  -Usually self-confident. Domineering. Anger over his mistakes. &lt;br&gt;
  &lt;br&gt;
  -No confidence&lt;/span&gt;&lt;/p&gt;
  &lt;p class=MsoNormal style='text-align:justify'&gt;&lt;span style='font-size:13.5pt;
  line-height:115%;font-family:"Verdana","sans-serif";mso-fareast-font-family:
  "Times New Roman";mso-bidi-font-family:"Times New Roman";color:black;
  mso-ansi-language:EN-US'&gt;-When carefully selected remedies fail to act
  especially in acute diseases it frequently rejuvenates powers of organism (in
  chronic disease - Psorinum). &lt;br&gt;
  &lt;br&gt;
  -Complaints that relapse&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br&gt;
  &lt;br&gt;
  -blah&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;&lt;br&gt;
  &lt;br&gt;
  -bleeh&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;&lt;br&gt;
  &lt;br&gt;
  -bloh&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;&lt;br&gt;
  &lt;br&gt;
  -bluh&lt;/span&gt;&lt;/p&gt;
</code></pre>
<p dir="auto">to become like:-</p>
<pre><code>&lt;p class=MsoNormal style='margin-bottom:12.0pt;line-height:normal'&gt;&lt;span
  style='font-size:13.5pt;font-family:"Verdana","sans-serif";mso-fareast-font-family:
  "Times New Roman";mso-bidi-font-family:"Times New Roman";color:black;
  mso-ansi-language:EN-US'&gt;-Self-conscious. SELFISH. Egotism. zxcvb&lt;br&gt;
  &lt;br&gt;
  -Usually self-confident. Domineering. Anger over his mistakes. &lt;br&gt;
  &lt;br&gt;
  -No confidence&lt;/span&gt;&lt;/p&gt;
  &lt;p class=MsoNormal style='text-align:justify'&gt;&lt;span style='font-size:13.5pt;
  line-height:115%;font-family:"Verdana","sans-serif";mso-fareast-font-family:
  "Times New Roman";mso-bidi-font-family:"Times New Roman";color:black;
  mso-ansi-language:EN-US'&gt;-When carefully selected remedies fail to act
  especially in acute diseases it frequently rejuvenates powers of organism (in
  chronic disease - Psorinum). zxcvb&lt;br&gt;
  &lt;br&gt;
  -Complaints that relapse&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;zxcvb&lt;br&gt;
  &lt;br&gt;
  -blah&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;zxcvb&lt;br&gt;
  &lt;br&gt;
  -bleeh&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;zxcvb&lt;br&gt;
  &lt;br&gt;
  -bloh&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;zxcvb&lt;br&gt;
  &lt;br&gt;
  -bluh&lt;/span&gt;&lt;/p&gt;
</code></pre>
<p dir="auto">that is, after the replacement, the text (in this case I’ve used <code>zxcvb</code> as an example) should be added before the <code>&lt;br&gt;</code> tag that is found (the first <code>&lt;br&gt;</code> tag in each block between <code>&lt;p.....&lt;/p&gt;</code>).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68511</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68511</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Mon, 02 Aug 2021 19:55:39 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Mon, 02 Aug 2021 06:22:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> I see that you are called the ReEx Guru here. Thanks for agreeing to help.<br />
I want this block of text:-</p>
<pre><code>&lt;p class=MsoNormal style='margin-bottom:12.0pt;line-height:normal'&gt;&lt;span
  style='font-size:13.5pt;font-family:"Verdana","sans-serif";mso-fareast-font-family:
  "Times New Roman";mso-bidi-font-family:"Times New Roman";color:black;
  mso-ansi-language:EN-US'&gt;-Self-conscious. SELFISH. Egotism. &lt;br&gt;
  &lt;br&gt;
  -Usually self-confident. Domineering. Anger over his mistakes. &lt;br&gt;
  &lt;br&gt;
  -No confidence&lt;/span&gt;&lt;/p&gt;
  &lt;p class=MsoNormal style='text-align:justify'&gt;&lt;span style='font-size:13.5pt;
  line-height:115%;font-family:"Verdana","sans-serif";mso-fareast-font-family:
  "Times New Roman";mso-bidi-font-family:"Times New Roman";color:black;
  mso-ansi-language:EN-US'&gt;-When carefully selected remedies fail to act
  especially in acute diseases it frequently rejuvenates powers of organism (in
  chronic disease - Psorinum). &lt;br&gt;
  &lt;br&gt;
  -Complaints that relapse&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br&gt;
  &lt;br&gt;
  -blah&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;&lt;br&gt;
  &lt;br&gt;
  -bleeh&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;&lt;br&gt;
  &lt;br&gt;
  -bloh&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;&lt;br&gt;
  &lt;br&gt;
  -bluh&lt;/span&gt;&lt;/p&gt;
</code></pre>
<p dir="auto">to become like:-</p>
<pre><code>&lt;p class=MsoNormal style='margin-bottom:12.0pt;line-height:normal'&gt;&lt;span
  style='font-size:13.5pt;font-family:"Verdana","sans-serif";mso-fareast-font-family:
  "Times New Roman";mso-bidi-font-family:"Times New Roman";color:black;
  mso-ansi-language:EN-US'&gt;-Self-conscious. SELFISH. Egotism. &lt;br&gt;zxcvb
  &lt;br&gt;
  -Usually self-confident. Domineering. Anger over his mistakes. &lt;br&gt;
  &lt;br&gt;
  -No confidence&lt;/span&gt;&lt;/p&gt;
  &lt;p class=MsoNormal style='text-align:justify'&gt;&lt;span style='font-size:13.5pt;
  line-height:115%;font-family:"Verdana","sans-serif";mso-fareast-font-family:
  "Times New Roman";mso-bidi-font-family:"Times New Roman";color:black;
  mso-ansi-language:EN-US'&gt;-When carefully selected remedies fail to act
  especially in acute diseases it frequently rejuvenates powers of organism (in
  chronic disease - Psorinum). &lt;br&gt;zxcvb
  &lt;br&gt;
  -Complaints that relapse&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br&gt;zxcvb
  &lt;br&gt;
  -blah&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;&lt;br&gt;zxcvb
  &lt;br&gt;
  -bleeh&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;&lt;br&gt;zxcvb
  &lt;br&gt;
  -bloh&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span&gt;&lt;br&gt;zxcvb
  &lt;br&gt;
  -bluh&lt;/span&gt;&lt;/p&gt;
</code></pre>
<p dir="auto">If I use the RegEx, <code>^[^/]+\K&lt;br&gt;</code> to find the last <code>&lt;br&gt;</code> tag in each block, between <code>&lt;p..........&lt;/p&gt;</code> and then replace it with, <code>&lt;br&gt;qwerty</code> which is what I put in the “replace” field, it replaces it with <code>&lt;br&gt;qwerty</code>, or rather adds the <code>zxcvb</code> text just after the last <code>&lt;br&gt;</code> tag in each block but I want to add  the <code>zxcvb</code> text just after the first <code>&lt;br&gt;</code> tag in each block as seen in the example given above.<br />
Please help me!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68491</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68491</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Mon, 02 Aug 2021 06:22:28 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Sun, 01 Aug 2021 21:48:28 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@scott-nielson</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@peterjones</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a> and <strong>All</strong>,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@scott-nielson</a>, you should <strong>not</strong> need to <strong>reverse</strong> the lines order to achieve some <strong>replacements</strong> !</p>
<p dir="auto">So, could you, like your <strong>first</strong> sample posted, provide us, both :</p>
<ul>
<li>
<p dir="auto">An <strong>initial</strong> example of your code containing <strong>several consecutive</strong> blocks <strong><code>&lt;p ••••••&lt;/p&gt;</code></strong></p>
</li>
<li>
<p dir="auto">The <strong>same</strong> <em>expected</em> blocks, <strong>after</strong> the modifications needed</p>
</li>
</ul>
<p dir="auto">We can agree to flag any <strong><code>HTML</code></strong> code, that is to be <strong>added</strong>, by the <strong>notation</strong> <strong><code>&lt;CODE 1&gt;</code></strong>, <strong><code>&lt;CODE 2&gt;</code></strong>, etc.</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68486</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68486</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 01 Aug 2021 21:48:28 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Sun, 01 Aug 2021 16:41:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@Scott-Nielson</a> ,</p>
<p dir="auto">Search the forum for “find the last”.  We’ve recently talked about how to do that.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68483</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68483</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sun, 01 Aug 2021 16:41:12 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Sun, 01 Aug 2021 11:27:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> or anyone else. I am doing Edit-&gt;Line Operations-&gt;Reverse line order, then in the RegEx mode,<br />
Find: <code>^[^/]+\K&lt;br&gt;</code> to find the last (which is actually the first since the lines are reversed) <code>&lt;br&gt;</code> tag in each section and Replace: <code>&lt;br&gt;zxcvb</code>,<br />
Then Find: <code>(?s)(?&lt;=color:black'&gt;)-(.*?) *(?=zxcvb)</code> and Replace: <code>qwerty$1xxx</code> where qwerty and xxx are some HTML codes I wanna add but is there a RegEx that can help me do the needful without the Edit-&gt;Line Operations-&gt;Reverse line order (to find the first <code>&lt;br&gt;</code> tag in each section)?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68473</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68473</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Sun, 01 Aug 2021 11:27:06 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 27 Jul 2021 14:37:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@Scott-Nielson</a></p>
<p dir="auto">Did you even read Peter’s “Please note” section above?<br />
This forum is about Notepad++, not about how to transform data with regular expressions.<br />
Plus, you aren’t really asking questions about regular expressions.<br />
You’re basically saying “do my regular expression writing work for me”.<br />
As Peter attempted to explain, this is frowned upon here.<br />
The extent of regular expression questions here should be general questions, such as “Which regex engine does N++ use?” or of course any suspected bugs with something going on with a regex.<br />
Don’t become a regex “taker” (seen many times here).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68379</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68379</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 27 Jul 2021 14:37:11 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 27 Jul 2021 14:25:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> Is there a limit on the number of questions one can ask here? I’m trying my best to find a solution and ask for a solution here only if I no longer find a solution!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68378</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68378</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Tue, 27 Jul 2021 14:25:59 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 27 Jul 2021 14:23:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> said in <a href="/post/68373">How do I replace only the first &lt;br&gt; tag across multiple files?</a>:</p>
<blockquote>
<p dir="auto">You are up to 6 regex questions in barely more than a month.</p>
</blockquote>
<p dir="auto">7 now!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68377</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68377</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 27 Jul 2021 14:23:07 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 27 Jul 2021 14:11:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> Thanks a lot man, you saved me a lot of time!<br />
Now, for the same block of text as posted right at the top, where I have this at the bottom/end:-</p>
<pre><code>&lt;br&gt;
    -Eyes&lt;/span&gt;&lt;/p&gt;
</code></pre>
<p dir="auto">How do I find all of those, replace the <code>&lt;br&gt;</code> tag (the last <code>&lt;br&gt;</code> tag in that block) with something else, keep the text - in this case, “-Eyes (with the dash)” and add something after the <code>&lt;/span&gt;&lt;/p&gt;</code>? I know that using a <code>$1</code>  in the “replace” field will keep the text - in this case, “-Eyes (with the dash)” and using <code> *(?=&lt;/span&gt;&lt;/p&gt;)</code> at the end will keep the <code>&lt;/span&gt;&lt;/p&gt;</code> string as it is, after the replacement.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68376</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68376</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Tue, 27 Jul 2021 14:11:39 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Mon, 16 Dec 2024 15:56:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@Scott-Nielson</a></p>
<p dir="auto">Read the documents (<a href="https://npp-user-manual.org/docs/searching/" rel="nofollow ugc">https://npp-user-manual.org/docs/searching/</a>).  There is an <a href="https://npp-user-manual.org/docs/searching/#anchors" rel="nofollow ugc">anchor</a> <code>\A</code> which anchors to the beginning of the document; and you already know <code>\K</code>.  And you already know how to do lookaheads and lookbehinds (including one I gave you that “looks for 1 or more characters, as long as none of them are the start of SOMEMAGICSTRING”) – and if you use quantifiers, you don’t even need something that complicated. Think about the logic you want, combine it with what you know.  Voila.</p>
<p dir="auto">Or search the forum for recent posts about “first line”, and find <a href="https://community.notepad-plus-plus.org/post/65511">this post</a>, which shows you how to anchor to the beginning of the document, though it’s use case is slightly different than yours</p>
<p dir="auto">In this case, the logic you want is "start at the beginning of the file; look for zero or more characters that come before the first <code>&lt;br&gt;</code> (so be non-greedy), restart the match, and match <code>&lt;br&gt;</code>.</p>
<ul>
<li>Original thought with the fancy negative lookahead previously shown: FIND = <code>(?s)\A((?!&lt;br&gt;).)*\K&lt;br&gt;</code></li>
<li>Simpler non-greedy: FIND = <code>(?s)\A.*?\K&lt;br&gt;</code></li>
</ul>
<p dir="auto">Both found the first (and only the first) occurrence of <code>&lt;br&gt;</code> in my file, and could be used in Find in Files</p>
<p dir="auto"><em>Note</em>: <code>\A</code> was fixed not too long ago, in <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/wiki/Changes-v7#791" rel="nofollow ugc">v7.9.1</a>; make sure you’re using v7.9.1 or newer</p>
<p dir="auto">----</p>
<p dir="auto"><em><strong>Please note</strong>: This Community Forum is not a data transformation service; you should not expect to be able to always say “I have data like X and want it to look like Y” and have us do all the work for you.  If you are new to the Forum, and new to regular expressions, we will often give help on the first one or two data-transformation questions, especially if they are well-asked and you show a willingness to learn; and we will point you to the documentation where you can learn how to do the data transformations for yourself in the future.  But if you repeatedly ask us to do your work for you, you will find that the patience of usually-helpful Community members wears thin.  The best way to learn regular expressions is by experimenting with them yourself, and getting a feel for how they work; having us spoon-feed you the answers without you putting in the effort doesn’t help you in the long term and is uninteresting and annoying for us.</em></p>
<p dir="auto">You are up to 6 regex questions in barely more than a month.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68373</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68373</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 16 Dec 2024 15:56:16 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 27 Jul 2021 08:27:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@Scott-Nielson</a> The RegEx, <code>^[^/]+\K&lt;br&gt;</code> replaced the last <code>&lt;br&gt;</code> tag in each block of text in each file, instead of the first (that’s what I want - to replace the first such tag)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68366</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68366</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Tue, 27 Jul 2021 08:27:41 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 27 Jul 2021 07:40:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@Scott-Nielson</a> said in <a href="/post/68362">How do I replace only the first &lt;br&gt; tag across multiple files?</a>:</p>
<blockquote>
<p dir="auto">(?i-s)^.<em>?\K(&lt;br&gt;)(?:.</em>\1)?</p>
</blockquote>
<p dir="auto">The above RegEx, <code>(?i-s)^.*?\K(&lt;br&gt;)(?:.*\1)?</code> also replaces all the <code>&lt;br&gt;</code> tags instead of just the first <code>&lt;br&gt;</code> tag of each file (of multiple files)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68365</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68365</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Tue, 27 Jul 2021 07:40:38 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 27 Jul 2021 06:09:22 GMT]]></title><description><![CDATA[<p dir="auto">This did not replace the needful either: <code>(?i-s)^.*?\K(&lt;br&gt;)(?:.*\1)?</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/68362</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68362</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Tue, 27 Jul 2021 06:09:22 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 27 Jul 2021 05:53:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@Scott-Nielson</a> How do I replace only the first <code>&lt;br&gt;</code> tag across multiple files (that is, the first <code>&lt;br&gt;</code> tag in each file) with <code>&lt;/span&gt;&lt;/p&gt;</code> ?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68361</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68361</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Tue, 27 Jul 2021 05:53:43 GMT</pubDate></item><item><title><![CDATA[Reply to How do I replace only the first &lt;br&gt; tag across multiple files? on Tue, 27 Jul 2021 05:46:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22335">@Scott-Nielson</a> This RegEx replaces every &lt;br&gt; tag: <code>(?:&lt;br&gt;|\G(?!^))(?:[^&lt;br&gt;]*)*?\K([^&lt;br&gt;]*)(?=(?:[^&lt;br&gt;]*)*?\1)</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/68360</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68360</guid><dc:creator><![CDATA[Scott Nielson]]></dc:creator><pubDate>Tue, 27 Jul 2021 05:46:22 GMT</pubDate></item></channel></rss>