<?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 and highlight a specific occurance of a symbol?]]></title><description><![CDATA[<p dir="auto">How to find and highlight a specific occurance of a symbol in a large text file.</p>
<p dir="auto">Example:</p>
<h1>Text<br />
Text</h1>
<h1>Text</h1>
<h1>Text<br />
Text</h1>
<h1>Text<br />
Text</h1>
<h1>Text<br />
Text</h1>
<h1>Text</h1>
<h1>Text</h1>
<h1>Text</h1>
<h1>Text</h1>
<p dir="auto">Need to find the 6th occurance of =========== and highlight it.</p>
<p dir="auto">Thanks</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/16104/how-to-find-and-highlight-a-specific-occurance-of-a-symbol</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 02:03:13 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/16104.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 29 Jul 2018 17:51:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Fri, 07 Sep 2018 14:13:19 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> and <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> :</p>
<p dir="auto">So after some thinking about this, I’ve decided that I don’t think the <code>\A</code> syntax is broken in Notepad++, and I don’t think that lookbehind assertions (either positive or negative) are broken in Notepad++ either.  One just has to fully understand how Notepad++ searching works.  And <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>, in your post just above, where you talk about a “first problem” and a “second problem” and beyond…I have <strong>NO</strong> problem with how Notepad++ works in these cases, given my new thinking!</p>
<p dir="auto">Every Notepad++ search has a “starting-point” when the user initiates a search, or that Notepad++ itself initiates after a successful match in the case where one of the “find all” searches (or a <strong>Find in Files</strong>) is conducted.  Each starting-point has exactly <em><strong>NOTHING</strong></em> before it.  <em>YOU</em> may <em>SEE</em> data before your caret when you initiate a <strong>Find Next</strong>, but Notepad++ doesn’t.  And that, IMO, isn’t necessarily a broken search feature, it is just “the way it works”.  To Notepad++, each starting-point appears the same as a start-of-file does–no data (aka <em><strong>NOTHING</strong></em>) comes before it.</p>
<p dir="auto">At the beginning of your regex, an <code>\A</code> assertion or ANY valid negative lookbehind assertion will match the <em><strong>NOTHING</strong></em> right at a starting-point (i.e., that part of the regex will always succeed).  Note that a negative lookbehind assertion doesn’t match the real data to the left of your caret, it matches the <em><strong>NOTHING</strong></em>.  Example: Have <code>12345678</code> (only) in your buffer and your caret between the <code>4</code> and the <code>5</code>.  Do a regex search for <code>(?&lt;!4)5</code> and see that it matches the 5.  The <code>(?&lt;!4)</code> in this case allows the match because <em><strong>NOTHING</strong></em> is not <code>4</code>.  Some would call this regex behavior “broken”…because YOU the user can see the darned <code>4</code> right there!</p>
<p dir="auto">While a search is “in-progress” on a buffer, however, no one would call negative lookbehind assertions broken.  Example:  Use the same buffer as before but have your caret between the <code>1</code> and the <code>2</code>.  Do a regex search for <code>(?&lt;!4)5</code> and see that there is no match.  In this case there is a <code>4</code> before the <code>5</code> (the search is “underway” at this point and Notepad++ is looking at the buffer…and this time the <code>4</code> is a part of that buffer) so the assertion fails the overall match.</p>
<p dir="auto">Side note:  With “Wrap around” ticked during a search, if no match is found between the current caret point and the end-of-file, a second (internal) search is done by Notepad++, with a starting-point at the start-of-file.  This is an additional opportunity for a match to happen at a “starting point”.  For more info on the “2nd search”, see <a href="https://notepad-plus-plus.org/community/topic/14704/select-mark-all-lines-which-contain-a-certain-pattern" rel="nofollow ugc">here</a>…quite far into that thread…  Although that thead discusses replacement, find a part of replacement, so it works the same way.</p>
<p dir="auto">So that brings us back to the regex under discussion:  <code>(?&lt;!\r|\n)^</code>.</p>
<p dir="auto">It will work like an “unbroken” <code>\A</code> in most cases.  A possible problem with it comes when doing “multiple” searches with it (or when the user-starting-point isn’t the start-of-file).  In those cases, if the previous action with it leaves the next starting-point at the start of any line, the next search will match <em>right there</em> – not only at start-of-file – which may not be what the user desires.  (Again, it will match that case because the <code>(?&lt;!\r|\n)</code> part will match the <em><strong>NOTHING</strong></em> and the <code>^</code> will hit).</p>
<p dir="auto">The best way to use it as an <code>\A</code>-equivalent is to have the end of your regex not leave the next starting-point at any start-of-line.</p>
<p dir="auto">So let’s go back to Terry’s original regex (or very close to it):</p>
<p dir="auto"><code>(?s)(?&lt;!\r|\n)^((.+?)===========){5}(.+?)\K(===========)</code></p>
<p dir="auto">When run on the OP’s sample data (duplicated a few times so that there are many more than 9 lines of <code>===========</code> data) this will find exactly ONE match when a “find all” is done.  That is because the end of the regex sets up the follow-on starting-point to NOT be able to match a start-of-line (needed by the <code>^</code> assertion).</p>
<p dir="auto">Changing the regex slightly at the end:</p>
<p dir="auto"><code>(?s)(?&lt;!\r|\n)^((.+?)===========){5}(.+?)\K(===========)\R</code></p>
<p dir="auto">This one will result in multiple matches using a “find all” in the OP’s (extended) data, for reasons which should now be apparent.  Thus it is worth pointing out in such a case that the <code>(?&lt;!\r|\n)^</code> regex is NOT what one normally thinks <code>\A</code> should be doing.  So while it <em>can</em> be a <code>\A</code> substitute, it still has to be used with some amount of caution, and of course, <em>understanding</em>.  :-)</p>
<p dir="auto">Back to <code>\A</code>:  You can be the judge of whether or not it is broken:  The Boost documentation for <code>\A</code> says “Matches at the start of a buffer only” – does one consider the “buffer” to be the entirety of the Notepad++ editor tab data, or the starting-point(s) through a later point for a search?  Your call.  :-)</p>
<p dir="auto">And now onto <code>\G</code>.  In <a href="https://notepad-plus-plus.org/community/topic/15058/regex-remove-particular-words-from-tags-in-several-text-pages" rel="nofollow ugc">this thread</a> , there are 3 conditions specified for where the <code>\G</code> assertion can match.  I believe there is only ONE place it can match; hint: the “starting-point” of a search.  :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/34704</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/34704</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Fri, 07 Sep 2018 14:13:19 GMT</pubDate></item><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Tue, 31 Jul 2018 16:45:56 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: scott-sumner">@<bdi>scott-sumner</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/rumi-balkhi" aria-label="Profile: rumi-balkhi">@<bdi>rumi-balkhi</bdi></a> and <strong>All</strong>,</p>
<p dir="auto"><strong>Very clever</strong> deduction, <strong>Terry</strong>. If we generalize to any kind of <strong>EOL</strong> characters, it gives <strong><code>(?&lt;!\n|\r|\f)^</code></strong>.</p>
<p dir="auto">Note that I added the <strong><code>\f</code></strong> syntax ( Control character <strong>Form Feed</strong>, <strong><code>\x0C</code></strong> or <strong><code>012</code></strong> decimal ) because, given, for instance, the text <strong><code>abcdefghij</code></strong>, with the <strong>Form Feed</strong> char, between the strings <strong>abcde</strong> et <strong>fghij</strong>, the regex <strong><code>(?-s)^.</code></strong> would also match the <strong><code>f</code></strong> letter avec the <strong>FF</strong> char. !</p>
<p dir="auto">So, to be short, the regex <strong><code>(?&lt;!\n|\r|\f)^</code></strong> seems a very nice <strong>word-around</strong> to emulate the <strong>bugged</strong> <strong><code>\A</code></strong> feature of the <strong>N++</strong> regex engine :-))</p>
<p dir="auto">I used the verb <em>seems</em> and not the verb <em>is</em> because, <strong>unfortunately</strong>, there are <strong>still</strong> some problems with that syntax :-((</p>
<hr />
<p dir="auto">Let’s work on that <strong>sample</strong> text, below, that you will copy on a <strong>new</strong> tab :</p>
<pre><code class="language-diff">Notepad++ v7.5.8 bug-fixes:
This is
a simple
text
12345&gt;&lt;67890
to test
the \A
feature
</code></pre>
<p dir="auto"><strong>Note</strong> : For <strong>all</strong> the tests, below, the options <strong><code>Regular expression</code></strong> and <strong><code>Wrap around</code></strong> are <strong>ticked</strong> !</p>
<ol>
<li><strong>First</strong> problem :</li>
</ol>
<p dir="auto">Let’s suppose that your cursor is located between the <strong><code>&gt;</code></strong> and <strong><code>&lt;</code></strong> characters, on the <strong><code>5th</code></strong> line. Using the regex <strong><code>(?&lt;!\n|\r|\f)^(?-s).</code></strong> ( which should stand for <strong><code>\A(?-s).</code></strong> ), it <strong>does</strong> find the letter <strong><code>N</code></strong> of <strong>Notepad++</strong>, on <strong>top</strong> of the text and any <strong>other</strong> click on the <strong><code>Find Next</code></strong> button does <strong>not</strong> find anything else. Nice !.</p>
<p dir="auto">Now place the cursor at beginning of the <strong><code>5th</code></strong> line, right <strong>before</strong> the <strong><code>1</code></strong> digit, <strong>without</strong> any selection and re-run the <strong><code>(?&lt;!\n|\r|\f)^(?-s).</code></strong> regex. This time, the <strong>first</strong> click on the <strong>Find Next</strong> button <strong>wrongly</strong> match the <strong><code>1</code></strong> digit. The <strong>second</strong> click finds the letter <strong><code>N</code></strong> as <strong>expected</strong>, and any <strong>subsequent</strong> clicks do nothing.</p>
<ol start="2">
<li><strong>Second</strong> problem :</li>
</ol>
<p dir="auto">Let apply the new regex <strong><code>(?&lt;!\n|\r|\f)^(?-s).*\R.*</code></strong> ( which should be a work-around of <strong><code>\A(?-s).*\R.*</code></strong>  ) against our <strong>sample</strong> text. The result is just <strong>identical</strong> to what I described in the point, just <strong>above</strong>. That is to say :</p>
<ul>
<li>
<p dir="auto">If cursor was between the <strong><code>&gt;</code></strong> and <strong><code>&lt;</code></strong> characters, it matches all contents of the <strong><code>1st</code></strong> line, with its <strong>EOL</strong> chars and all contents of the <strong><code>2nd</code></strong> line, without its <strong>EOL</strong> chars</p>
</li>
<li>
<p dir="auto">If cursor was at beginning of the <strong><code>5th</code></strong> line , then :</p>
<ul>
<li>
<p dir="auto">After a <strong>first</strong> click, it matches all contents of the <strong><code>5th</code></strong> line, with its <strong>EOL</strong> chars + all contents of the <strong><code>6th</code></strong> line, without its <strong>EOL</strong> chars</p>
</li>
<li>
<p dir="auto">After a <strong>second</strong> click, it matches all contents of the <strong><code>1st</code></strong> line, with its <strong>EOL</strong> chars + all contents of the <strong><code>2nd</code></strong> line, without its <strong>EOL</strong> chars</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">Now, let’s <strong>slightly</strong> change the regex, adding an <strong><code>\R</code></strong> syntax, at the <strong>end</strong> of the regex, which becomes :</p>
<p dir="auto"><strong><code>(?&lt;!\n|\r|\f)^(?-s).*\R.*\R</code></strong></p>
<p dir="auto">Now, even if we place the cursor <strong>between</strong> the <strong><code>&gt;</code></strong> and <strong><code>&lt;</code></strong> characters, any click on the <strong>Find Next</strong> button will match, successively, <strong>two consecutive</strong> lines ( The <strong><code>1st</code></strong> and the <strong><code>2nd</code></strong>, then, the <strong><code>3rd</code></strong> and the <strong><code>4th</code></strong> one,… and so on :-((</p>
<p dir="auto">Just because the <strong>end</strong> of this regex matches a <strong><code>\r</code></strong> or <strong><code>\n</code></strong> character !</p>
<hr />
<p dir="auto">Anyway, <strong>Terry</strong>, don’t be sad ! Logically, your <strong><code>(?&lt;!\n|\r|\f)^</code></strong> regex should work as a <strong>work-around</strong> of the <strong><code>\A</code></strong> syntax. It’s simply because our present regex engine does <strong>not</strong> handle <strong>backward assertions</strong>, properly, too ! I didn’t test it, yet, but I suppose the your regex should work in some <strong>regex testers</strong>, on Web :-))</p>
<p dir="auto">And I agree, with <strong>Scott</strong> : You, certainly, are a “<strong>regex  sheriff</strong>” !</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33847</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33847</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 31 Jul 2018 16:45:56 GMT</pubDate></item><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Mon, 30 Jul 2018 22:30:27 GMT]]></title><description><![CDATA[<p dir="auto">Sorry, not a sheriff, maybe a deputy.</p>
<p dir="auto">I’m quite enjoying helping out (where I can) although i do need to curb my enthusiasm somewhat. And thanks to you <code>Scott Summer</code> and <code>@guy038</code> for your support.</p>
<p dir="auto">And yes, Scott i agree the \R or \r\n would probably look better, I just haven’t tested that yet. As my dad always said, measure twice, cut once. So i need to test, refine, test again before presenting!</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33838</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33838</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 30 Jul 2018 22:30:27 GMT</pubDate></item><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Mon, 30 Jul 2018 22:24:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a></p>
<p dir="auto">Nice one…hopefully a downside to this is <em>NOT</em> found.  I’m not “with” Notepad++ or RegexBuddy right now, but maybe this also works?:  <code>(?&lt;!\R)^</code>  Maybe not, though as lookbehinds must be of constant length and <code>\R</code> could be of length 1 (in the case of <code>\r</code> or <code>\n</code>) or length 2 (for <code>\r\n</code>)…would be nice if it did though because I think it is nicer on the eyes than <code>\x0A</code>.  :-)</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>, I think there’s a(nother) regex sheriff in town, and his name is <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a>…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33836</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33836</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Mon, 30 Jul 2018 22:24:28 GMT</pubDate></item><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Mon, 30 Jul 2018 22:14:38 GMT]]></title><description><![CDATA[<p dir="auto">I think I may have found another regex (building on what we already have) that will; (no matter where in the file the cursor is); ALWAYS select the nth occurence. I used some other string check that I’d provided some weeks ago to someone who originally stated the <code>\A</code> didn’t work for them. My latest rendition is:<br />
Find: <code>(?s)(?&lt;!\x0A)^((.+?)===========){5}(.+?)\K(===========)</code></p>
<p dir="auto">So the <code>(?&lt;!\x0A)^</code> should (hopefully) look for the occurence of a line starting position where there aren’t any line feed/carriage returns immediately before (actually I only test for the line feed portion). So far my tests have shown it ALWAYS selects only the 6th occurrence (in the example) and even with a second click does not change position. With putting the cursor in various positions within the file it still correctly locates the 6th position.</p>
<p dir="auto">This negates the need to be careful where the cursor is in the file before looking for the nth occurrence and also the need to include the additional <code>.*</code> at the end to grab the rest of the content, thus preventing a double click going to the nth * 2 occurrence.</p>
<p dir="auto">Since the <code>\A</code> seems very problematic I’ve now added <code>(?&lt;!\x0A)^</code> to my arsenal!</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33834</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33834</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 30 Jul 2018 22:14:38 GMT</pubDate></item><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Mon, 30 Jul 2018 12:00: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:</p>
<blockquote>
<p dir="auto">I added the ### mark on top of the Rumi’s text</p>
</blockquote>
<p dir="auto">Well…sure, but when one answers a regex question here, one sort of assumes that <em>changing</em> the OP’s source text to solve a problem is <em>not allowed</em>.  :-)</p>
<p dir="auto">Of course, doing that when solving a problem that requires “table-building”…well, then…maybe in that case we bend the rules, eh?  :-D</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33824</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33824</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Mon, 30 Jul 2018 12:00:07 GMT</pubDate></item><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Mon, 30 Jul 2018 11:46:08 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/rumi-balkhi" aria-label="Profile: rumi-balkhi">@<bdi>rumi-balkhi</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: scott-sumner">@<bdi>scott-sumner</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: terry-r">@<bdi>terry-r</bdi></a>, and <strong>All</strong>,</p>
<p dir="auto"><strong>Terry</strong>, The <strong><code>\A</code></strong> feature is <strong>broken</strong> in the <strong>N++</strong> implementation of the <strong>Boost Regex</strong> library. For an <strong>alternate</strong> regex engine, see the <strong>last</strong> part the the <strong>updated</strong> FAQ topic, below  :</p>
<p dir="auto"><a href="https://notepad-plus-plus.org/community/topic/15765/faq-desk-where-to-find-regex-documentation" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/15765/faq-desk-where-to-find-regex-documentation</a></p>
<hr />
<p dir="auto">However, I found a very <strong>simple</strong> way to <strong>prevent</strong> from matching, <strong>every 6</strong> times the <strong><code>===========</code></strong> line !</p>
<p dir="auto">Just add a <strong>specific</strong> expression at the <strong>very beginning</strong> of the file, that does <strong>not</strong> exist elsewhere, in <strong>current</strong> file. Then, <strong>Scott</strong>, we just add, <strong>first</strong>, that expression in your <strong>regex</strong> :-)) For instance :</p>
<ul>
<li>
<p dir="auto">I added the <strong><code>###</code></strong> mark on <strong>top</strong> of the <strong>Rumi</strong>’s text</p>
</li>
<li>
<p dir="auto">And I used the <strong>modified</strong> regex <strong><code>(?s)###(?:.+?===========){5}.+?\K===========</code></strong></p>
</li>
</ul>
<p dir="auto">Voilà !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33823</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33823</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 30 Jul 2018 11:46:08 GMT</pubDate></item><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Mon, 30 Jul 2018 03:42:54 GMT]]></title><description><![CDATA[<p dir="auto">Thanks Scott for those tweaks.</p>
<p dir="auto">I have a question about why the <code>\A</code> didn’t work in this instance. Had it done so, then it would ALWAYS start at the start of the file, and even if run multiple times it would still select only the <code>nth</code> occurrence. As well, your <code>.*</code> at the end of the regex wouldn’t then be required.</p>
<p dir="auto">I do continue to forget the <code>(?s)</code> and <code>(?i)</code> at the start, often using the tick boxes over this approach. Of course using these allows for a standard approach to the regex (not having to change tick boxes for every expression) and allowing each regex to stand on it’s own.</p>
<p dir="auto">I hadn’t tested the occurrence of 2 consecutive lines of '='s hence my disclaimer, that was only added into the reply as I was typing it (my testing wasn’t exhaustive).</p>
<p dir="auto">Terry</p>
<p dir="auto">(The day you stop learning is the day you die!)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33817</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33817</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 30 Jul 2018 03:42:54 GMT</pubDate></item><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Mon, 30 Jul 2018 02:32:05 GMT]]></title><description><![CDATA[<p dir="auto">Terry R is heading in the direction I was going, but he posted first.  I would slightly tweak his regex (which works) to get this:</p>
<p dir="auto"><code>(?s)(?:.+?===========){5}.+?\K===========.*</code></p>
<p dir="auto">The tweaks:</p>
<ul>
<li>Use <code>(?s)</code> at the start to avoid having the “newline” box be a dependency</li>
<li>Remove some unnecessary group-capturing parentheses</li>
<li>Add <code>.*</code> at the end to prevent matching every multiple-of-six groupings (it will highlight/mark from the sixth grouping of <code>=</code> thru the end-of-file…maybe this is undesirable but I think in a large file it would make it easier to find where the highlighting/marking begins!)</li>
</ul>
<p dir="auto">Note that the OP said he wanted to highlight the match, so I take this to mean using the <strong>Mark</strong> tab of the <strong>Find</strong> window for this.</p>
<p dir="auto">Terry R said:</p>
<blockquote>
<p dir="auto">It might not work it there are any sequences of 2 lines together with “=” in them</p>
</blockquote>
<p dir="auto">It <em>WILL</em> work in such a case!</p>
<p dir="auto">Here’s an explanation of the regex:</p>
<ul>
<li><a href="http://www.regular-expressions.info/modifiers.html" rel="nofollow ugc">Use these options for the whole regular expression</a> <code>(?s)</code>
<ul>
<li><a href="http://www.regular-expressions.info/modifiers.html" rel="nofollow ugc">Dot matches line breaks</a> <code>s</code></li>
</ul>
</li>
<li><a href="http://www.regular-expressions.info/brackets.html" rel="nofollow ugc">Match the regular expression below</a> <code>(?:.+?===========){5}</code>
<ul>
<li><a href="http://www.regular-expressions.info/repeat.html#limit" rel="nofollow ugc">Exactly 5 times</a> <code>{5}</code></li>
<li><a href="http://www.regular-expressions.info/dot.html" rel="nofollow ugc">Match any single character</a> <code>.+?</code>
<ul>
<li><a href="http://www.regular-expressions.info/repeat.html#lazy" rel="nofollow ugc">Between one and unlimited times, as few times as possible, expanding as needed (lazy)</a> <code>+?</code></li>
</ul>
</li>
<li><a href="http://www.regular-expressions.info/characters.html" rel="nofollow ugc">Match the character string “===========” literally</a> <code>===========</code></li>
</ul>
</li>
<li><a href="http://www.regular-expressions.info/dot.html" rel="nofollow ugc">Match any single character</a> <code>.+?</code>
<ul>
<li><a href="http://www.regular-expressions.info/repeat.html#lazy" rel="nofollow ugc">Between one and unlimited times, as few times as possible, expanding as needed (lazy)</a> <code>+?</code></li>
</ul>
</li>
<li><a href="http://www.regular-expressions.info/keep.html" rel="nofollow ugc">Keep the text matched so far out of the overall regex match</a> <code>\K</code></li>
<li><a href="http://www.regular-expressions.info/characters.html" rel="nofollow ugc">Match the character string “===========” literally</a> <code>===========</code></li>
<li><a href="http://www.regular-expressions.info/dot.html" rel="nofollow ugc">Match any single character</a> <code>.*</code>
<ul>
<li><a href="http://www.regular-expressions.info/repeat.html" rel="nofollow ugc">Between zero and unlimited times, as many times as possible, giving back as needed (greedy)</a> <code>*</code></li>
</ul>
</li>
</ul>
<p dir="auto">Created with <a href="http://www.regexbuddy.com/" rel="nofollow ugc">RegexBuddy</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/33816</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33816</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Mon, 30 Jul 2018 02:32:05 GMT</pubDate></item><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Mon, 30 Jul 2018 01:59:10 GMT]]></title><description><![CDATA[<p dir="auto">I have something that might work. It does require that you have the cursor at the very start of the file however (so file must be open in notepad++). Once the search has found the text, if you hit the search again it will carry on to the next multiple of the number you want, so 60th, then 120th etc.<br />
The regex needs the ‘newline’ ticked as well.<br />
Expression is<br />
Find: <code>((.+?)===========){5}(.+?)\K(===========)</code></p>
<p dir="auto">Maybe someone could expand on this, alter it to fit better.</p>
<p dir="auto">So if you want the 6th occurrence, use 5 in the regex (where you see 5. If 60th then use 59. It might not work it there are any sequences of 2 lines together with “=” in them. If there are not 11 “=”, then change the number in the regex to suit.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33815</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33815</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 30 Jul 2018 01:59:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Mon, 30 Jul 2018 01:22:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: Scott-Sumner">@<bdi>Scott-Sumner</bdi></a></p>
<p dir="auto">I tried to find using following code<br />
(?-s).<em>(\R).</em>\R.*=========</p>
<p dir="auto">But its manual and it highlights all =========</p>
<p dir="auto">I want only specific occurance. It could be the 6th or 60th or even 100th.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33814</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33814</guid><dc:creator><![CDATA[Rumi Balkhi]]></dc:creator><pubDate>Mon, 30 Jul 2018 01:22:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to find and highlight a specific occurance of a symbol? on Sun, 29 Jul 2018 18:29:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rumi-balkhi" aria-label="Profile: Rumi-Balkhi">@<bdi>Rumi-Balkhi</bdi></a></p>
<p dir="auto">What have you tried and how isn’t it working?  It might be instructive to see your thought processes in finding a solution…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33812</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33812</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sun, 29 Jul 2018 18:29:41 GMT</pubDate></item></channel></rss>