<?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 bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ?]]></title><description><![CDATA[<p dir="auto">Hi, <strong>All</strong>,</p>
<p dir="auto">From that <strong>issue</strong> created in August 2019 by <a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: scott-sumner">@<bdi>scott-sumner</bdi></a> ( <strong>Scott</strong>, thanks for your many <strong>GitHub</strong> contributions ! )</p>
<p dir="auto"><a href="https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6018" rel="nofollow ugc">https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6018</a></p>
<p dir="auto">and the <strong>commit</strong> :</p>
<p dir="auto"><a href="https://github.com/alberto-dev/notepad-plus-plus/commit/520678cf1bc20bf701bc130564463a40e2391cef" rel="nofollow ugc">https://github.com/alberto-dev/notepad-plus-plus/commit/520678cf1bc20bf701bc130564463a40e2391cef</a></p>
<p dir="auto">We are, from now on, able to mark any <strong>non-empty</strong> line, involved in a <strong>multi-lines</strong> search ;-))</p>
<p dir="auto">Due to this <strong>nice</strong> improvement, my <strong>previous</strong> post, below, about multi-lines <strong>bookmarking</strong> is rather <strong>obsolete</strong> :-(</p>
<p dir="auto"><a href="https://notepad-plus-plus.org/community/topic/16701/how-to-mark-lines-above-marked-lines/8" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/16701/how-to-mark-lines-above-marked-lines/8</a></p>
<hr />
<p dir="auto">So, here is an <strong>updated</strong> version ;-))</p>
<p dir="auto">Notes :</p>
<ul>
<li>
<p dir="auto">First, you’re presently using the Notepad++ <strong>version</strong> <strong><code>7.8</code></strong> or <strong>above</strong></p>
</li>
<li>
<p dir="auto">I assume that you’re using the <strong><code>Edit &gt; Mark...</code></strong> dialog :</p>
<ul>
<li>
<p dir="auto">The options <strong><code>Bookmark lines</code></strong>, <strong><code>Purge for each search</code></strong> and <strong><code>Wrap around</code></strong>  are <strong>ticked</strong></p>
</li>
<li>
<p dir="auto">The <strong><code>Regular expression</code></strong> mode is <strong>selected</strong></p>
</li>
</ul>
</li>
<li>
<p dir="auto">The search process is supposed to be <strong>sensitive</strong> to case, due to the <strong><code>(?-i)</code></strong> <strong>in-line</strong> modifier</p>
</li>
<li>
<p dir="auto">To simplify, I assume that the lines, containing the <strong><code>XXX</code></strong> criterion, do <strong>not</strong> overlap with the lines <strong>around</strong>, which need <strong>bookmarking</strong> !</p>
</li>
</ul>
<hr />
<p dir="auto">Edited on <strong>11-16-2019</strong></p>
<p dir="auto">The <strong>end</strong> of this <strong>present</strong> post is rather <strong>obsolete</strong> and/or <strong>erroneous</strong>, as my <strong>updated</strong> regexes can, now,  handle <strong>pure empty</strong> lines, too !</p>
<p dir="auto">So you should better to refer to the <strong>next</strong> post, below :</p>
<p dir="auto"><a href="https://community.notepad-plus-plus.org/post/48541">https://community.notepad-plus-plus.org/post/48541</a></p>
<hr />
<ul>
<li>
<p dir="auto">You certainly noticed that the <strong>marking</strong> feature does <strong>not</strong> bookmark <strong>empty</strong> lines. So, if your text contains <strong>empty</strong> lines, that you would like to <strong>bookmark</strong>, too, a possible <strong>work-around</strong> could be to use a <strong>dummy</strong> character, not used <strong>yet</strong> in your file and, <strong>temporarily</strong>, replace any <strong>true empty</strong> line with some of these <strong>dummy</strong> chars, using the following <strong>regex</strong> S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>^(?=\R)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>###</code></strong> , if the <strong><code>#</code></strong> symbol is presently <strong>absent</strong> from your file contents</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">After the <strong>red-marking</strong> and <strong>bookmarking</strong> operation, with an <strong>appropriate</strong> search regex :</p>
<ul>
<li>
<p dir="auto">In your <strong>original</strong> file, just perform  an <strong><code>Edit &gt; Undo</code></strong> operation ( or <strong><code>Ctrl + Z</code></strong> )</p>
</li>
<li>
<p dir="auto">In the <strong>new</strong> tab, where you would had <strong>copied</strong> all the <strong>bookmarked</strong> lines  ( <strong><code> Search &gt; Bookmark &gt; Copy Bookmarked Lines</code></strong> ) run this simple regex <strong>S/R</strong> :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>^###</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
</li>
</ul>
<hr />
<p dir="auto">This <strong>first</strong> table, below, shows how to mark <strong>consecutive</strong> lines, <strong>around</strong> a line containing a <strong>specific</strong> expression <strong><code>XXX</code></strong>. <strong>Almost</strong> obvious ;-))</p>
<pre><code class="language-z">    •======================================================•===========•==========•===========•
    |  REGULAR expression to mark Line X, containing 'XXX' | Nth lines |  Line X  | Mth lines |
    |  and Nth lines BEFORE and/or Mth lines AFTER line X  |   BEFORE  |          |   AFTER   |
    •======================================================•===========•==========•===========•
    | (?-is)^(.+\R){N}(?=.*XXX)                            |    YES    |     NO   |      NO   |
    •------------------------------------------------------•-----------•----------•-----------•
    | (?-is)^.*XXX.*\R\K(.+\R){M}                          |     NO    |     NO   |     YES   |
    •------------------------------------------------------•-----------•----------•-----------•
    | (?-is)^(.+\R){N}(?=.*XXX)|^.*XXX.*\R\K(.+\R){M}      |    YES    |     NO   |     YES   |
    •------------------------------------------------------•-----------•----------•-----------•
    | (?-is)^.*XXX.*                  ( TRIVIAL case )     |     NO    |    YES   |      NO   |
    •------------------------------------------------------•-----------•----------•-----------•
    | (?-is)^(.+\R){N}.*XXX.*                              |    YES    |    YES   |      NO   |
    •------------------------------------------------------•-----------•----------•-----------•
    | (?-is)^.*XXX.*\R(.+\R){M}                            |     NO    |    YES   |     YES   |
    •------------------------------------------------------•-----------•----------•-----------•
    | (?-is)^(.+\R){N}.*XXX.*\R(.+\R){M}                   |    YES    |    YES   |     YES   |
    | (?-is)^(.+\R){N}.*XXX.*\R(?1){M}                     |           |          |           |
    •======================================================•===========•==========•===========•
</code></pre>
<p dir="auto"><strong>IMPORTANT</strong> :</p>
<p dir="auto">Of course, you must replace the <strong><code>N</code></strong> and <strong><code>M</code></strong> variables, in the regexes, with an non-null <strong>integer</strong>, standing for the number of <strong>wanted</strong> lines, respectively, <strong>before</strong> and <strong>after</strong> the specific <strong>line X</strong> !</p>
<hr />
<p dir="auto">In this <strong>second</strong> table, here are the regexes which does <strong>NOT</strong> bookmark any <strong><code>Line X</code></strong>, but <strong>only</strong> the <strong><code>1</code></strong> or <strong><code>2</code></strong> lines <strong>around</strong> the <strong><code>Line X</code></strong> :</p>
<pre><code class="language-z">    •=========================================================•==========•==========•==========•==========•==========•
    |  REGULAR expression, marking ONE or TWO lines, BEFORE   | 2nd line | 1st line |  Line X  | 1st line | 2nd line |
    |  / AFTER a line X, containing 'XXX', except the line X  |  BEFORE  |  BEFORE  |          |   AFTER  |   AFTER  |
    •=========================================================•==========•==========•==========•==========•==========•
    | (?-is)^.*XXX.*\R.+\R\K.+                                |     NO   |     NO   |     NO   |     NO   |    YES   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    | (?-is)^.*XXX.*\R\K.+                                    |     NO   |     NO   |     NO   |    YES   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    | (?-is)^.*XXX.*\R\K.+\R.+                                |     NO   |     NO   |     NO   |    YES   |    YES   |
    •=========================================================•==========•==========•==========•==========•==========•
    | (?-is)^.+(?=\R.*XXX)                                    |     NO   |    YES   |     NO   |     NO   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    | (?-is)^.+(?=\R.*XXX)|^.*XXX.*\R.+\R\K.+                 |     NO   |    YES   |     NO   |     NO   |    YES   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    | (?-is)^.+(?=\R.*XXX)|^.*XXX.*\R\K.+                     |     NO   |    YES   |     NO   |    YES   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    | (?-is)^.+(?=\R.*XXX)|^.*XXX.*\R\K.+\R.+                 |     NO   |    YES   |     NO   |    YES   |    YES   |
    •=========================================================•==========•==========•==========•==========•==========•
    | (?-is)^.+(?=\R.+\R.*XXX)                                |    YES   |     NO   |     NO   |     NO   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    | (?-is)^.+(?=\R.+\R.*XXX)|^.*XXX.*\R.+\R\K.+             |    YES   |     NO   |     NO   |     NO   |    YES   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    | (?-is)^.+(?=\R.+\R.*XXX)|^.*XXX.*\R\K.+                 |    YES   |     NO   |     NO   |    YES   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    | (?-is)^.+(?=\R.+\R.*XXX)|^.*XXX.*\R\K.+\R.+             |    YES   |     NO   |     NO   |    YES   |    YES   |
    •=========================================================•==========•==========•==========•==========•==========•
    | (?-is)^.+\R.+(?=\R.*XXX)                                |    YES   |    YES   |     NO   |     NO   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    | (?-is)^.+\R.+(?=\R.*XXX)|^.*XXX.*\R.+\R\K.+             |    YES   |    YES   |     NO   |     NO   |    YES   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    | (?-is)^.+\R.+(?=\R.*XXX)|^.*XXX.*\R\K.+                 |    YES   |    YES   |     NO   |    YES   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    | (?-is)^.+\R.+(?=\R.*XXX)|^.*XXX.*\R\K.+\R.+             |    YES   |    YES   |     NO   |    YES   |    YES   |
    •=========================================================•==========•==========•==========•==========•==========•
</code></pre>
<hr />
<ul>
<li>In the <strong>third</strong> table, here are the regexes which <strong>do</strong> bookmark the <strong><code>Line X</code></strong>, as well as <strong><code>1</code></strong> or <strong><code>2</code></strong> lines <strong>around</strong> <strong><code>Line X</code></strong> :</li>
</ul>
<pre><code class="language-z">    •=========================================================•==========•==========•==========•==========•==========•
    |  REGULAR expression, marking line X, containing 'XXX',  | 2nd line | 1st line |  Line X  | 1st line | 2nd line |
    |   as well as ONE or TWO lines, BEFORE / AFTER line X    |  BEFORE  |  BEFORE  |          |   AFTER  |   AFTER  |
    •=========================================================•==========•==========•==========•==========•==========•
    |  (?-is)^.*XXX.*                    ( Trivial case )     |     NO   |     NO   |    YES   |     NO   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.*XXX.*\R|\G.+\R\K.+                            |     NO   |     NO   |    YES   |     NO   |    YES   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.*XXX.*\R.+                                     |     NO   |     NO   |    YES   |    YES   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.*XXX.*\R.+\R.+                                 |     NO   |     NO   |    YES   |    YES   |    YES   |
    •=========================================================•==========•==========•==========•==========•==========•
    |  (?-is)^.+\R.*XXX.*                                     |     NO   |    YES   |    YES   |     NO   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.+\R.*XXX.*\R|\G.+\R\K.+                        |     NO   |    YES   |    YES   |     NO   |    YES   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.+\R.*XXX.*\R.+                                 |     NO   |    YES   |    YES   |    YES   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.+\R.*XXX.*\R.+\R.+                             |     NO   |    YES   |    YES   |    YES   |    YES   |
    •=========================================================•==========•==========•==========•==========•==========•
    |  (?-is)^.+(?=\R.+\R.*XXX)|^.*XXX.*                      |    YES   |     NO   |    YES   |     NO   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.+(?=\R.+\R.*XXX)|^.*XXX.*\R|\G.+\R\K.+         |    YES   |     NO   |    YES   |     NO   |    YES   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.+(?=\R.+\R.*XXX)|^.*XXX.*\R.+                  |    YES   |     NO   |    YES   |    YES   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.+(?=\R.+\R.*XXX)|^.*XXX.*\R.+\R.+              |    YES   |     NO   |    YES   |    YES   |    YES   |
    •=========================================================•==========•==========•==========•==========•==========•
    |  (?-is)^.+\R.+\R.*XXX.*                                 |    YES   |    YES   |    YES   |     NO   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.+\R.+\R.*XXX.*\R|\G.+\R\K.+                    |    YES   |    YES   |    YES   |     NO   |    YES   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.+\R.+\R.*XXX.*\R.+                             |    YES   |    YES   |    YES   |    YES   |     NO   |
    •---------------------------------------------------------•----------•----------•----------•----------•----------•
    |  (?-is)^.+\R.+\R.*XXX.*\R.+\R.+                         |    YES   |    YES   |    YES   |    YES   |    YES   |
    •=========================================================•==========•==========•==========•==========•==========•
</code></pre>
<hr />
<p dir="auto">Although, the different regexes <strong>still</strong> seem rather <strong>difficult</strong> to interpret, there are <strong>more simple</strong> than before ;-))</p>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/18505/how-to-bookmark-lines-around-a-line-containing-a-specific-expression-xxx</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 23:13:55 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/18505.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 Nov 2019 12:49:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Wed, 23 Oct 2024 16:58:41 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><br />
Sorry for the inconvenience caused.</p>
<p dir="auto">Thanks a lot will try this. I m sure this will work.</p>
<p dir="auto">Regards,<br />
Aa</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97274</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97274</guid><dc:creator><![CDATA[sam rathod]]></dc:creator><pubDate>Wed, 23 Oct 2024 16:58:41 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Wed, 23 Oct 2024 16:38:10 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">Ah, OK. Now, I understand all the story !</p>
<p dir="auto">Just note that you should have put your text as <strong>raw</strong> text, using the <strong><code>&lt;/&gt;</code></strong> indication when replying and <strong>not</strong> pasting an <strong>image</strong>. Indeed, even with a <em>OCR</em> plugin, within my favorite <strong>graphic</strong> viewer, I was <strong>not</strong> able to <strong>convert</strong> the letters of your image into <strong>raw</strong> text :-(( This explains the <strong>delay</strong> of my reply !</p>
<hr />
<p dir="auto">So, with this kind of <em>INPUT</em> text :</p>
<pre><code class="language-diff">
 SACS CONNECT Edition V(15.1) - CL                                                        Company: .
             *********** SACS IX SEASTATE PROGRAM ***********               DATE 23-OCT-2024  TIME 07:31:44   SEA PAGE   208
                                     ***** SEASTATE COMBINED LOAD CASE SUMMARY *****
                                              RELATIVE TO MUDLINE ELEVATION
   LOAD  LOAD              FX           FY           FZ           MX           MY           MZ
   CASE  LABEL
                          (KN)         (KN)         (KN)       (KN-M)       (KN-M)       (KN-M)
                         
   127  7119             -125.62      -190.83     -4342.63       4582.3      -3032.8      -1382.1
   128  7120                0.54      -212.18     -4388.18       5164.0        863.9      -1432.1
   129  7121              111.01      -159.93     -4333.70       3602.5       4267.7      -1399.5
   130  7122              202.80       -78.61     -4340.74       1053.9       7076.4      -1374.5
   131  7131              264.55       -39.54     -4341.04       1111.7       8733.7      -1299.3
</code></pre>
<p dir="auto">Just use the search regex, below, in order to <strong>mark</strong> the <strong>expected</strong> lines :</p>
<p dir="auto">SEARCH / MARK <strong><code>(?-is)^.+SEASTATE COMBINED LOAD CASE SUMMARY.+\R(?:.+\R){5}\K(?:.+\R){5}</code></strong></p>
<hr />
<p dir="auto">Notes :</p>
<ul>
<li>
<p dir="auto">Note that I use <strong>non-capturing</strong> groups <strong><code>(?:.......)</code></strong>, instead of <strong>capturings</strong> ones <strong><code>(.......)</code></strong>, for each block of <strong>five</strong> lines.</p>
</li>
<li>
<p dir="auto">Now, after the <strong>complete</strong> line containing the string <strong><code>SEASTATE COMBINED LOAD CASE SUMMARY</code></strong>, with this <strong>exact</strong> case</p>
</li>
<li>
<p dir="auto">And the <strong>five</strong> lines that follow,</p>
</li>
<li>
<p dir="auto">The <strong><code>\K</code></strong> syntax cancel any <strong>previous</strong> search, so far</p>
</li>
<li>
<p dir="auto">So, the <strong>next five</strong> lines are <strong>only</strong> taken in account by the regex engine and <strong>marked</strong></p>
</li>
</ul>
<hr />
<p dir="auto">Method :</p>
<ul>
<li>
<p dir="auto">Open the <strong>Mark</strong> dialog ( <strong><code>Ctrl + M</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong>Uncheck</strong> all <strong>box</strong> options</p>
</li>
<li>
<p dir="auto">SEARCH / MARK <strong><code>(?-is)^.+SEASTATE COMBINED LOAD CASE SUMMARY.+\R(?:.+\R){5}\K(?:.+\R){5}</code></strong></p>
</li>
<li>
<p dir="auto">Just <strong>check</strong> the <strong><code>Bookmark line</code></strong>, <strong><code>Purge for each search</code></strong> and <strong><code>Wrap around</code></strong> box options</p>
</li>
<li>
<p dir="auto">Select the <strong><code>Regular expression</code></strong> search mode</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Mark All</code></strong> button</p>
</li>
<li>
<p dir="auto">Now, you may either :</p>
<ul>
<li>
<p dir="auto">Copy all these <strong>bookmarked</strong> lines in an other <strong>new</strong> tab  with the <strong><code>Search &gt; Bookmark &gt; Copy Bookmarked Lines</code></strong> option</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Copy Marked Text</code></strong> button and paste the <strong>clipboard</strong> contents in an <strong>other</strong> tab</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97261</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97261</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 23 Oct 2024 16:38:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Wed, 23 Oct 2024 12:00:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</bdi></a></p>
<p dir="auto">Sample of data i am trying to figure out.</p>
<p dir="auto"><img src="/assets/uploads/files/1729684829542-tmp_f01d3921-e931-4f57-b01c-3308f3437ea2.png" alt="tmp_f01d3921-e931-4f57-b01c-3308f3437ea2.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/97253</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97253</guid><dc:creator><![CDATA[sam rathod]]></dc:creator><pubDate>Wed, 23 Oct 2024 12:00:31 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Wed, 23 Oct 2024 11:52:34 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><br />
No i am not able to bookmark only the specific line that i want mark.</p>
<p dir="auto">Basically i want to find a specific text , ignore 4 lines after it and mark&amp; select 5 line after the specific text &amp; 4 lines.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97252</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97252</guid><dc:creator><![CDATA[sam rathod]]></dc:creator><pubDate>Wed, 23 Oct 2024 11:52:34 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Wed, 23 Oct 2024 10:36:30 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I do <strong>not</strong> understand clearly what you want to achiveve !</p>
<p dir="auto">Given this <em>INPUT</em> text, below :</p>
<pre><code class="language-diff">"This is the specific text in the document that i will search"
Line1 that dont want marked
Line2 that dont want marked

Line3 that dont want marked

Line 1 want to mark
Line 2 want to mark
Line 3 want to mark
Line 4 want to mark
Line 5 want to mark

""This is the specific text in the document that i will search"
Line1 that dont want marked
Line2 that dont want marked

Line3 that dont want marked

Line 6 want to mark
Line 7 want to mark
Line 8 want to mark
Line 9 want to mark
Line 10 want to mark
</code></pre>
<p dir="auto">And let’s suppose that you’ve previously <strong>bookmarked all</strong> the lines with the <strong><code>Line #..# want to mark</code></strong> syntax</p>
<p dir="auto">Then just use the <strong><code>Search &gt; Bookmark &gt; Remove Unmarked lines</code></strong> option and you’re left with the following <strong>expected</strong> <em>OUTPUT</em> text :</p>
<pre><code class="language-diff">Line 1 want to mark
Line 2 want to mark
Line 3 want to mark
Line 4 want to mark
Line 5 want to mark
Line 6 want to mark
Line 7 want to mark
Line 8 want to mark
Line 9 want to mark
Line 10 want to mark
</code></pre>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto">~</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97249</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97249</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 23 Oct 2024 10:36:30 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Wed, 23 Oct 2024 07:43:57 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">If i have range of text for example</p>
<pre><code>"This is the specific text in the document that i will search"
Line1 that dont want marked
Line2 that dont want marked

Line3 that dont want marked

Line 1 want to mark
Line 2 want to mark
Line 3 want to mark
Line 4 want to mark
Line 5 want to mark

""This is the specific text in the document that i will search"
Line1 that dont want marked
Line2 that dont want marked

Line3 that dont want marked

Line 6 want to mark
Line 7 want to mark
Line 8 want to mark
Line 9 want to mark
Line 10 want to mark
</code></pre>
<p dir="auto">The output i am expecting</p>
<pre><code>Line 1 want to mark
Line 2 want to mark
Line 3 want to mark
Line 4 want to mark
Line 5 want to mark
Line 6 want to mark
Line 7 want to mark
Line 8 want to mark
Line 9 want to mark
Line 10 want to mark
</code></pre>
<pre><code>^.*This is the specific text in the document that i will search.*\R(?:.*\R){5}((?:.*\R){5})
</code></pre>
<p dir="auto">Tried various option but unable to skip the lines as everything after specific text is getting marked.</p>
<p dir="auto">Regards,<br />
Aa</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97248</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97248</guid><dc:creator><![CDATA[sam rathod]]></dc:creator><pubDate>Wed, 23 Oct 2024 07:43:57 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sun, 24 Mar 2024 14:15:24 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</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/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</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">I suppose that dealing with files with <strong>important</strong> size may lead to this <strong>regex</strong> message, even if this regex <strong>does</strong> work properly with <strong>small</strong> files :-((</p>
<p dir="auto">So, <a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</bdi></a>, could you try with this <strong>new</strong> regex version :</p>
<p dir="auto">SEARCH/MARK <strong><code>(?-is)^(?:.*\R){12}.*IGNORED.*\R</code></strong></p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93769</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93769</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 24 Mar 2024 14:15:24 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sun, 24 Mar 2024 10:52:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</bdi></a> said in <a href="/post/93764">How to bookmark lines around a line containing a specific expression 'XXX' ?</a>:</p>
<blockquote>
<p dir="auto">will appreciate if u can share some learning material to start from the basics</p>
</blockquote>
<p dir="auto">A good starting point is <a href="https://community.notepad-plus-plus.org/topic/15765/faq-where-to-find-regular-expressions-regex-documentation">HERE</a>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93768</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93768</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 24 Mar 2024 10:52:14 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sun, 24 Mar 2024 06:38:27 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> said in <a href="/post/93756">How to bookmark lines around a line containing a specific expression 'XXX' ?</a>:</p>
<blockquote>
<p dir="auto">(?i-s)(.*\R){12}^.<em>ignored.</em>\R</p>
</blockquote>
<p dir="auto">The screenshot looks fuzzy but i had entered the same equation that was been mentioned by <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>.</p>
<p dir="auto">Will go through the FAQs for sharing data and will understand how to post on this.</p>
<p dir="auto">I tried the final Regex :</p>
<pre><code>(?i-s)(.*\R){12}^.*ignored.*\R
</code></pre>
<p dir="auto"><img src="/assets/uploads/files/1711262051406-27da62cf-3dc0-462b-aa57-00c5e2c74694-image.png" alt="27da62cf-3dc0-462b-aa57-00c5e2c74694-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Thanks for actively resolving the issue i was facing, will appreciate if u can share some learning material to start from the basics.</p>
<p dir="auto">Thanks &amp; Regards,<br />
Aaditya</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93764</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93764</guid><dc:creator><![CDATA[sam rathod]]></dc:creator><pubDate>Sun, 24 Mar 2024 06:38:27 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sun, 24 Mar 2024 06:29:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> said in <a href="/post/93754">How to bookmark lines around a line containing a specific expression 'XXX' ?</a>:</p>
<blockquote>
<p dir="auto">(?-i)^(?: +*+ [A-Z][A-Z0-9 ]+ *+\R)(?:.*\R){1,25}(?: +*{4} WARNING - THE REMAINING +[0-9]+ INCREMENT(S) OF THE LOAD STEP WILL BE IGNORED)$</p>
</blockquote>
<p dir="auto">This did the wonder, thanks for the help man on my own i would never been able to figure this out. I am new to notepad++ will appreciate if you can share some learning material to start from basics.</p>
<p dir="auto">Thanks a Lot.</p>
<p dir="auto">Regards,<br />
Aaditya</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93763</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93763</guid><dc:creator><![CDATA[sam rathod]]></dc:creator><pubDate>Sun, 24 Mar 2024 06:29:37 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sat, 23 Mar 2024 17:25:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</bdi></a> said in <a href="/post/93742">How to bookmark lines around a line containing a specific expression 'XXX' ?</a>:</p>
<blockquote>
<p dir="auto">This is the error that it is showing after entering the regex command:</p>
</blockquote>
<p dir="auto">That’s an exeedingly fuzzy screenshot.<br />
<img src="/assets/uploads/files/1711214707267-3492b2f6-8569-4ac7-a3a9-cff5dfa764b0-image.png" alt="3492b2f6-8569-4ac7-a3a9-cff5dfa764b0-image.png" class=" img-fluid img-markdown" /><br />
But to me, that looks a lot more like <code>(.*\R}{10}^.*ignored.*\R</code> instead of <code>(.*\R){10}^.*ignored.*\R</code> – the first group is accidentally closed by a curly-brace <code>}</code> instead of a close-parenthesis <code>)</code>.  Assuming that fuzzy character really is <code>}</code>, I can replicate your error; and if I hover over the <code>...</code> in the error message, it tells me exactly what’s gone wrong with the expression:<br />
<img src="/assets/uploads/files/1711213415774-faf7ceca-84f5-4d1c-b78f-463aa4d851a0-image.png" alt="faf7ceca-84f5-4d1c-b78f-463aa4d851a0-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">If it’s actually something else wrong with yours, that <code>...</code> hover will help you diagnose it.</p>
<p dir="auto">But either way, if I enter the regex that you <em>claimed</em> to use, rather than the one that your fuzzy screenshot shows, it just shows that it’s not finding text, not that there was an error in the regex.</p>
<p dir="auto"><img src="/assets/uploads/files/1711213539673-2f4372d8-d9ec-485a-86d0-6d75d991254e-image.png" alt="2f4372d8-d9ec-485a-86d0-6d75d991254e-image.png" class=" img-fluid img-markdown" /></p>
<blockquote>
<p dir="auto">I tried attaching files but i am unable to.</p>
</blockquote>
<p dir="auto">That’s not the right way of sharing data, as has been explained in the FAQs about <a href="https://community.notepad-plus-plus.org/topic/21925/faq-formatting-forum-posts">formatting example text</a> and the <a href="https://community.notepad-plus-plus.org/topic/22022/faq-template-for-search-replace-questions">template for search/replace questions</a>.    Those FAQs show how to format your text so that it appears in the copyable text box (which is how I changed your original post using moderator powers to show the data in the text box – I will actually go back and remove the extra line endings, which may have been accidentally introduced when I did the first edit).</p>
<p dir="auto">When i use the expression that you said you were using, on the data that you had in your post, I match <em>almost</em> what your followon post said you wanted to match:</p>
<p dir="auto"><img src="/assets/uploads/files/1711213983204-606b245c-6f7e-4620-b960-481276681591-image.png" alt="606b245c-6f7e-4620-b960-481276681591-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The reason it doesn’t match everything is because you said you wanted 10 lines before the “ignored” line… but your screenshot with manual highlight shows that you actually wanted 12 lines before the “ignored” line, so you just need to change the count from <code>{10}</code> to <code>{12}</code> …</p>
<p dir="auto">And, as your regex uses <code>ignored</code> but your actual text is <code>IGNORED</code>, and as we want to make sure that the <code>.</code> from the first capture group doesn’t match newlines, the final regex you should use is<br />
FIND WHAT = <code>(?i-s)(.*\R){12}^.*ignored.*\R</code> – as shown below, this matches what you say you want to match.</p>
<p dir="auto"><img src="/assets/uploads/files/1711214187965-4383f782-17e9-4e4b-8544-b9257dca3ada-image.png" alt="4383f782-17e9-4e4b-8544-b9257dca3ada-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/93756</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93756</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sat, 23 Mar 2024 17:25:14 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sat, 23 Mar 2024 16:10:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</bdi></a> - I start out by trying to see if there is a pattern to the data that I can take advantage of. I test this carefully to understand any possible exceptions to the pattern.</p>
<p dir="auto">You have provided two examples and so from that the pattern I see is the the sections that you want to highlight start with these lines:</p>
<pre><code class="language-txt">                                      ** SACS COLLAPSE IMPACT ENERGY ABSORPTION **
          **** FINAL DEFLECTIONS AND ROTATIONS FOR LOAD SEQUENCE LCE1 ****
</code></pre>
<p dir="auto">I also see that above this is the page header which starts with <code>SACS CONNECT Edition</code> and so first do a test <code>(?-i)^SACS CONNECT Edition</code> and count how many page headers there are. Let’s say there are 957 in the file. I write down <code>957</code> so I won’t forget.</p>
<p dir="auto">I then build a regular expression that matches the start of the data. I’ll do <code>(?-i)^ +\*+ [A-Z0-9 ]+ \*+$</code> and verify that it matches exactly <code>957</code> times in the file. If it fails to match exactly <code>957</code> times then I tighten or loosen the regular expression as needed until it nails <code>957</code>.</p>
<p dir="auto">I do the same thing for the IGNORED lines. I first do <code>(?-i)IGNORED$</code> and count.  Let’s say there are <code>57</code> and so I write that down.  The full pattern for the IGNORED lines seems to be <code>(?-i)^ +\*{4} WARNING - THE REMAINING +[0-9]+ INCREMENT\(S\) OF THE LOAD STEP WILL BE IGNORED$</code>  Adjust that expression until it gets exactly <code>57</code> matches.</p>
<p dir="auto">Now we know we have <code>957</code> page headers and <code>57</code> of them are the ones we are interested in. As the sample size you have provided only has one example of what we want to match I will use a more general</p>
<pre><code class="language-txt">(?-i)^(?: +\*+ [A-Z][A-Z0-9 ]+ \*+\R)(?:.*\R){1,25}(?: +\*{4} WARNING - THE REMAINING +[0-9]+ INCREMENT\(S\) OF THE LOAD STEP WILL BE IGNORED)$
</code></pre>
<p dir="auto">Drop that into Notepad++.  I added a couple of extra parentheses in there so that when you move the cursor to a <code>(</code> or <code>)</code> that Notepad++ will highlight the other one of of the <code>(</code> … <code>)</code> pairs.</p>
<p dir="auto">The groups within that rather long expression are:</p>
<ul>
<li><code>(?-i)</code> - Turn the ignore letter case flag off.</li>
<li><code>^(?: +\*+ [A-Z][A-Z0-9 ]+ \*+\R)</code> - This is the thing that matches the start of the blocks we want to select. We know it matches <code>957</code> times.</li>
<li><code>(?:.*\R){1,25}</code> - Allow for one to 25 lines that may be empty or may have stuff.</li>
<li><code>(?: +\*{4} WARNING - THE REMAINING +[0-9]+ INCREMENT\(S\) OF THE LOAD STEP WILL BE IGNORED)$</code> - This matches the last line of the things we are interested in.</li>
</ul>
<p dir="auto">In this case I solved the problem by using <code>(?:.*\R){1,25}</code>.  I know that the first line will match many times but don’t want to bother with scanning too far before testing for the last line.  With a better sample size I likely would tune <code>{1,25}</code> to be a better match for how far down that <code>IGNORED</code> line is.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93754</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93754</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Sat, 23 Mar 2024 16:10:49 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sat, 23 Mar 2024 07:22:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a><br />
Hello,</p>
<p dir="auto">Actually the occurrence of SACS CONNECT Edition is at multiple times so i guess that might be one issue, also i tried the  &lt;(?-i)^SACS CONNECT Edition(?s).<em>IGNORED(?-s).</em>&gt; but it is giving this error:<br />
<img src="/assets/uploads/files/1711178530726-ca22ddb2-1218-4703-8eb2-f88b6b6a7dbf-image.png" alt="ca22ddb2-1218-4703-8eb2-f88b6b6a7dbf-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Regards,<br />
Aaditya</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93743</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93743</guid><dc:creator><![CDATA[sam rathod]]></dc:creator><pubDate>Sat, 23 Mar 2024 07:22:23 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sat, 23 Mar 2024 07:16:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a><br />
Hey<br />
The output that I am expecting:<br />
<img src="/assets/uploads/files/1711178004893-e256c5ec-61e7-4f9b-b662-7a0ff7ac65cd-image.png" alt="e256c5ec-61e7-4f9b-b662-7a0ff7ac65cd-image.png" class=" img-fluid img-markdown" /><br />
The area marked in grey is what i want MARKED</p>
<p dir="auto">This is the error that it is showing after entering the regex command:<br />
<img src="/assets/uploads/files/1711178042711-6245c6bf-ff6b-4d21-a8d7-bad8664c1be3-image.png" alt="6245c6bf-ff6b-4d21-a8d7-bad8664c1be3-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I tried attaching files but i am unable to.</p>
<p dir="auto">Thanks guys for reaching out so quick to such an old topic, much appreciated.</p>
<p dir="auto">Regards,<br />
Aaditya</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93742</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93742</guid><dc:creator><![CDATA[sam rathod]]></dc:creator><pubDate>Sat, 23 Mar 2024 07:16:33 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Fri, 22 Mar 2024 19:13:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</bdi></a> As <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> noted, your regular expression is valid.</p>
<p dir="auto"><strong>@all</strong> - I discovered it’s challenging as I think I think <a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</bdi></a> intended to start the extraction at the line that starts with <code>SACS CONNECT Edition</code> <strong>and</strong> that the does not count empty or blank-only lines as “lines.”</p>
<p dir="auto">But, how can can we go backwards by nine lines that are not blank/empty from the <code>IGNORED</code> anchor?</p>
<p dir="auto">Thinking forwards is much easier for me: <code>^SACS CONNECT Edition(?s).*IGNORED(?-s).*</code></p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</bdi></a> the <code>(?s)</code> part puts the regular expression engine in a mode where dot also matched end of lines meaning we will skip/match all lines from <code>SACS CONNECT Edition</code> up to the word <code>IGNORED</code>.  Once we get to <code>IGNORED</code> we do <code>(?-s)</code> which turns the dot matching end-of-line thing off and the final <code>.*</code> picks up the remainder of the line.</p>
<p dir="auto">To make this safer I would use the case-sensitive <code>(?-i)^SACS CONNECT Edition(?s).*IGNORED(?-s).*</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/93737</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93737</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Fri, 22 Mar 2024 19:13:29 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Fri, 22 Mar 2024 14:47:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sam-rathod" aria-label="Profile: sam-rathod">@<bdi>sam-rathod</bdi></a> said in <a href="/post/93733">How to bookmark lines around a line containing a specific expression 'XXX' ?</a>:</p>
<blockquote>
<p dir="auto">post <code>(.*\R){10}^.*ignored.*\R</code> but it is showing Invalid Regular Expression.</p>
</blockquote>
<p dir="auto">What you typed in your post is valid regex, so I have to assume that’s not what you had in the FIND WHAT field.  If that’s exactly what you had, please show a screenshot of the whole dialog box</p>
]]></description><link>https://community.notepad-plus-plus.org/post/93734</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93734</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 22 Mar 2024 14:47:44 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sat, 23 Mar 2024 17:23:33 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><br />
Hey, i am trying to extract 10 lines above word “ignored”, i tried using this command from your other post <code>(.*\R){10}^.*ignored.*\R</code> but it is showing Invalid Regular Expression.<br />
Following are few lines from the whole text file.l, can u help me out. Thanks for your valuable posts.</p>
<pre><code>      B465  B416  100.00    0.00    0.00     1.17   -32.75   -12.11   346.17   791.11  1618.77    0.042
B483  B478  B486  100.00    0.00    0.00    -0.88    -2.81     1.55   211.14   417.77   795.80    0.007
      B478  B363  100.00    0.00    0.00     4.29    -2.66   -14.84   302.41   721.07  1413.40    0.011
B479  B476  B477    0.00  100.00    0.00    -0.35     2.33     0.63   183.52   417.34   794.06    0.006
      B476  B481   26.71   73.29    0.00    -0.61    -4.35    -2.34   190.81   417.34   794.06    0.011
      B476  B361  100.00    0.00    0.00     3.32    -1.65    32.38   217.19   472.63   999.46    0.033
B477  B479  B473    3.69   96.31    0.00    -5.24    -5.33     0.82   258.08   587.08  1162.04    0.010
      B479  B485    0.00  100.00    0.00    -5.05     4.64     2.77   256.20   587.08  1162.04    0.009
      B479  B408  100.00    0.00    0.00    -2.39   -10.75   -12.76   421.63   791.10  1618.76    0.016
B489  B479  B487   41.71   58.29    0.00    -0.69    -2.92     0.72   195.22   417.80   795.95    0.007
      B479  B485    0.00  100.00    0.00    -0.39     0.16     0.72   183.81   417.80   795.95    0.001
      B479  B363  100.00    0.00    0.00     0.26    -1.57    22.99   217.53   473.15  1001.83    0.023
B485  B489  B477    9.91   90.09    0.00    -5.01    -5.55     0.06   261.25   587.09  1162.07    0.010
      B489  B492    0.00  100.00    0.00    -4.52    -4.82     4.16   256.20   587.09  1162.07    0.009
      B489  B417  100.00    0.00    0.00     0.30    -6.94    -7.89   346.17   791.11  1618.80    0.010
 
[FF]

SACS CONNECT Edition V(15.1) - CL                                                        Company: Lamprell Energy Ltd.
       CRPO-126-MRJN 2050/2059 - JACKET BOAT IMPACT ANALYSIS                        DATE 11-MAR-2024  TIME 06:50:22   CLP PAGE 1151

                                      ** SACS COLLAPSE IMPACT ENERGY ABSORPTION **
 
 
                                        INCREMENT  37          LOAD FACTOR     6.200
 
                                                Aggregate          Incremental
                                                   (MJ)                (MJ) 
              Energy absorbed by structure  =        0.1262              0.0021
              % of total energy absorbed    =      100.9477   (%)        1.6442   (%)
 
 
     **** WARNING - IMPACT ENERGY ABSORBED AT LOAD STEP    37
     **** WARNING - THE REMAINING    96 INCREMENT(S) OF THE LOAD STEP WILL BE IGNORED
 
[FF]
SACS CONNECT Edition V(15.1) - CL                                                        Company: Lamprell Energy Ltd.

       CRPO-126-MRJN 2050/2059 - JACKET BOAT IMPACT ANALYSIS                        DATE 11-MAR-2024  TIME 06:50:22   CLP PAGE 1152

          **** FINAL DEFLECTIONS AND ROTATIONS FOR LOAD SEQUENCE LCE1 ****
                                 LOAD CASE OE01
                               LOAD FACTOR  6.200
 
 
                   ****** DEFLECTIONS ******   ******* ROTATIONS *******
          JOINT       X        Y        Z          X        Y        Z
                      CM       CM       CM        RAD      RAD      RAD
 
 
          0243       0.192   -0.712   -0.005    0.00146  0.00058 -0.00019
          0269       0.348   -0.873   -0.736    0.00168  0.00070  0.00022
          0276       0.399   -0.518   -1.297    0.00117  0.00063  0.00030
          0277       0.137   -0.584   -0.590    0.00151  0.00037  0.00020
          101L       0.364   -0.914   -0.734    0.00168  0.00070  0.00022
          102L       0.414   -0.547   -1.296    0.00117  0.00063  0.00030
</code></pre>
<p dir="auto">Regards,<br />
Aaditya</p>
<p dir="auto">-–</p>
<p dir="auto"><em>moderator added code markdown around text; please don’t forget to <a href="https://community.notepad-plus-plus.org/topic/21925/faq-desk-formatting-forum-posts">use the <code>&lt;/&gt;</code> button to mark example text as “code”</a> so that characters don’t get changed by the forum</em></p>
]]></description><link>https://community.notepad-plus-plus.org/post/93733</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/93733</guid><dc:creator><![CDATA[sam rathod]]></dc:creator><pubDate>Sat, 23 Mar 2024 17:23:33 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sun, 01 Mar 2020 21:49:47 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/notpad001" aria-label="Profile: notpad001">@<bdi>notpad001</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a>,</p>
<p dir="auto"><strong>Alan</strong>, I wouldn’t say it is <strong>blasphemous</strong>, but rather <strong>inappropriate</strong> !</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51073</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51073</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 01 Mar 2020 21:49:47 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sun, 01 Mar 2020 21:52:02 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/notpad001" aria-label="Profile: notpad001">@<bdi>notpad001</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">No <strong>problem</strong> !  We just have to <strong>add</strong> the regex <strong><code>\h*</code></strong>, matching any range, even <strong>null</strong>, of <strong>horizontal blank</strong> characters, so, mainly, the <strong>tab</strong> and <strong>space</strong> chars, at every <strong>beginning</strong> of line of the regex</p>
<p dir="auto">So, in case you want to <strong>keep</strong> sections, containing the <strong><code>GENDER=MALE</code></strong> string, this would result in the *<strong>new</strong> regex syntaxes, below :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?s-i)^\h*STARTDATA:\R\h*GENDER=FEMALE.+?^\h*ENDDATA:?\R?</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
<p dir="auto">OR</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?s-i)^\h*STARTDATA:\R(?-s:.*\R){</code>M<code>,</code>N<code>}\h*GENDER=FEMALE.+?^\h*ENDDATA:?\R?</code></strong> ( Do <strong>not</strong> forget to replace <strong>M</strong> and <strong>N</strong> variables with true <strong>integers</strong> ! )</p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
<p dir="auto">Test, for example, the regex <strong><code>(?s-i)^\h*STARTDATA:\R\h*GENDER=FEMALE.+?^\h*ENDDATA:?\R?</code></strong> against the text, below :</p>
<pre><code class="language-z">    STARTDATA:
        GENDER=MALE
    NAME=JOE
		AGE=34
    HEIGHT=181
				ENDDATA:
    STARTDATA:
    GENDER=FEMALE
	NAME=MARIA
    AGE=38
    HEIGHT=163
        ENDDATA:
	    STARTDATA:
    GENDER=FEMALE
	NAME=DIANA
    AGE=56
				    HEIGHT=150
    ENDDATA:
	STARTDATA:
    GENDER=MALE
                NAME=KEVIN
    AGE=21
    HEIGHT=201
    WEIGHT=97
	ENDDATA:
</code></pre>
<p dir="auto">You should get the text :</p>
<pre><code class="language-z">    STARTDATA:
        GENDER=MALE
    NAME=JOE
		AGE=34
    HEIGHT=181
				ENDDATA:
	STARTDATA:
    GENDER=MALE
                NAME=KEVIN
    AGE=21
    HEIGHT=201
    WEIGHT=97
		ENDDATA:
</code></pre>
<p dir="auto">And, in order to delete <strong>any blank</strong> character, after the <strong>first</strong> <strong><code>N</code></strong> characters of <strong>each</strong> line :</p>
<ul>
<li>
<p dir="auto">Use the <strong><code>Edit &gt; Blank Operations &gt; TAB to Space</code></strong> menu option to replace each <strong>tab</strong> char with its <strong>appropriate</strong> number of <strong>space</strong> character(s)</p>
</li>
<li>
<p dir="auto">Secondly, use this <strong>generic</strong> regex S/R, which will <strong>delete</strong> any <strong>space</strong> char, after the first <strong><code>N</code></strong> : characters of the <strong>each</strong> line</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>^\x20{</code>N<code>}\K\x20+</code></strong> ( we’ll use, in our case, the <strong>real</strong> regex <strong><code>^\x20{4}\K\x20+</code></strong> )</p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">After clicking on the <strong><code>Replace All</code></strong> button, <strong>exclusively</strong>, you’re left with that <strong>expected</strong> result :</p>
<pre><code class="language-z">    STARTDATA:
    GENDER=MALE
    NAME=JOE
    AGE=34
    HEIGHT=181
    ENDDATA:
    STARTDATA:
    GENDER=MALE
    NAME=KEVIN
    AGE=21
    HEIGHT=201
    WEIGHT=97
    ENDDATA:
</code></pre>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51072</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51072</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 01 Mar 2020 21:52:02 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sun, 01 Mar 2020 21:14:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/notpad001" aria-label="Profile: NotPad001">@<bdi>NotPad001</bdi></a> said in <a href="/post/51067">How to bookmark lines around a line containing a specific expression 'XXX' ?</a>:</p>
<blockquote>
<p dir="auto">wildcard search criteria</p>
</blockquote>
<p dir="auto">You should pay closer attention.<br />
<a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> is attempting to educate you about “regular expressions”.<br />
To even speak of “wildcard search” in the same breath is blasphemous.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51071</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51071</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 01 Mar 2020 21:14:25 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sun, 01 Mar 2020 16:25:23 GMT]]></title><description><![CDATA[<p dir="auto">Thanks guy038 – you are spot on!<br />
Now it works very well after I included the missing : on the last row in my example. My fault – and I will be more observant! Also thanks for the additional information. You know your stuff!!</p>
<p dir="auto">Related questions on this topic:<br />
Is it possible to include wildcard search criteria such as instead of searching for GENDER=MALE you only search for NDER=MA in a similar way as using the star (*) in front of NDER=MA when searching for things in Excel. The requested result is to Bookmark Line the same lines as in the example that you guy038 solved.</p>
<p dir="auto">Because: I noticed that in case I have spaces in front of the GENDER=MALE  – I cannot get it to work. Do you have any ideas how to solve that use case?</p>
<p dir="auto">Example: GENDER=MALE has 2 spaces in front of it – but the number of spaces can vary. Ideally I would like to use the wildcard approach as well in the cases where there are spaces in front of the text.</p>
<p dir="auto">Also: In case the lines STARTDATA: and ENDDATA: also have empty Spaces in front of it – can that be captured as well? The use case is to mark the same Lines as successfully marked in the example that you guy038 fixed.</p>
<p dir="auto">Thanks a lot!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51067</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51067</guid><dc:creator><![CDATA[NotPad001]]></dc:creator><pubDate>Sun, 01 Mar 2020 16:25:23 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sun, 01 Mar 2020 04:38:23 GMT]]></title><description><![CDATA[<p dir="auto">Hi NotPad001 and <strong>All</strong>,</p>
<p dir="auto">Ah ! I understood why the regex does <strong>not</strong> match the <strong><code>2nd</code></strong> section with <strong><code>GENDER=MALE</code></strong> Don’t you see it ? Well, seemingly, from your picture, the <strong>last</strong> line ( line <strong><code>25</code></strong> ) does <strong>not</strong> end with a <strong>colon</strong> character ! And it’s obvious that searching from <strong><code>GENDER=FEMALE</code></strong> sections worked perfectly <strong>right</strong> ;-))</p>
<p dir="auto">So the <strong>correct</strong> regex to process is :</p>
<p dir="auto">SEARCH <strong><code>(?s-i)^STARTDATA:\R(?-s:.*\R){0,3}GENDER=MALE.+?^ENDDATA:?</code></strong></p>
<p dir="auto">I just added a <strong>regex</strong> question mark symbol ( <strong><code>?</code></strong> ), which is a <strong>shorthand</strong> of the <strong><code>{0,1}</code></strong> quantifier, at the <strong>end</strong> of the regex</p>
<p dir="auto">BTW, note that, if the line <strong><code>GENDER=....</code></strong> is located <strong>right after</strong> the <strong><code>STARTDATA:</code></strong> line, you may simply use the <strong>shorter</strong> regex :</p>
<p dir="auto">SEARCH <strong><code>(?s-i)^STARTDATA:\RGENDER=MALE.+?^ENDDATA:?</code></strong></p>
<hr />
<p dir="auto">Now, there are a <strong>lot</strong> of methods to <strong>filter out</strong> your text : Let’s suppose that you want to <strong>keep</strong> sections with <strong><code>GENDER=MALE</code></strong>, <strong>only</strong> :</p>
<ul>
<li>
<p dir="auto">First, you could use an option from the <strong>Bookmark</strong> menu ( <strong><code>Search &gt; Bookmark</code></strong> )</p>
<ul>
<li>
<p dir="auto"><strong>Bookmark</strong> sections containing <strong><code>GENDER=MALE</code></strong>, with the <strong>appropriate</strong> regex and, then, use the option <strong><code>Search &gt; Bookmark &gt; Remove Unmarked lines</code></strong></p>
</li>
<li>
<p dir="auto"><strong>Bookmark</strong> sections containing <strong><code>GENDER=FEMALE</code></strong>, with the <strong>appropriate</strong> regex and, then, use the option <strong><code>Search &gt; Bookmark &gt; Remove Bookmarked lines</code></strong></p>
</li>
</ul>
</li>
<li>
<p dir="auto">Secondly, you could use <strong>one</strong> of the two <strong>regex</strong> S/R, below, ( <strong><code>Ctrl + H</code></strong> ), directly, searching for <strong><code>GENDER=FEMALE</code></strong> sections and clicking on the <strong><code>Replace All</code></strong> button :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?s-i)^STARTDATA:\RGENDER=FEMALE.+?^ENDDATA:?\R?</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
<li>
<p dir="auto">SEARCH <strong><code>(?s-i)^STARTDATA:\R(?-s:.*\R){</code>M<code>,</code>N<code>}GENDER=FEMALE.+?^ENDDATA:?\R?</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">Remark that, in order to <strong>delete</strong> the <strong>entire</strong> lines <strong><code>ENDDATA:</code></strong>, we need to add the part <strong><code>\R?</code></strong> at the <strong>end</strong> of the regexes to match the <strong>line-break</strong> of lines <strong><code>ENDDATA(:)</code></strong> too, which is <strong>optional</strong>, in case that the <strong>very last</strong> line of your file is <strong>not</strong> followed with a <strong>line-break</strong> !</p>
<p dir="auto">Best regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51066</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51066</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 01 Mar 2020 04:38:23 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sat, 29 Feb 2020 20:49:19 GMT]]></title><description><![CDATA[<p dir="auto">Thanks guy038 and this was very good help –and looks promising! -  but I have a dilemma:<br />
For GENDER=MALE I used the regex (?s-i)^STARTDATA:\R(?-s:.*\R){0,3}GENDER=MALE.+?^ENDDATA:<br />
=&gt; This correctly Marked row 1-6 (Great)<br />
However: Row 19-25 was not Marked</p>
<p dir="auto">For GENDER=FEMALE I used the regex (?s-i)^STARTDATA:\R(?-s:.*\R){0,3}GENDER=FEMALE.+?^ENDDATA:<br />
=&gt; This correctly Marked Two set of FEMALE rows 7-12 and 13-18 (Great)</p>
<p dir="auto">The dilemma is that the file I have contains a lot of data and I want to be able to filter out all GENDER=MALE date. (Row 1-6 and 19-25)<br />
I toggled:<br />
Bookmark line ticked<br />
Purge for each search<br />
Wrap around<br />
Regular expression</p>
<p dir="auto">Thanks a lot!</p>
<p dir="auto"><img src="/assets/uploads/files/1583009278802-gender-male.jpg" alt="GENDER=MALE.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto"><img src="/assets/uploads/files/1583009328001-gender-female.jpg" alt="GENDER=FEMALE.jpg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/51065</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51065</guid><dc:creator><![CDATA[NotPad001]]></dc:creator><pubDate>Sat, 29 Feb 2020 20:49:19 GMT</pubDate></item><item><title><![CDATA[Reply to How to bookmark lines around a line containing a specific expression &#x27;XXX&#x27; ? on Sat, 29 Feb 2020 11:24:20 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/notpad001" aria-label="Profile: notpad001">@<bdi>notpad001</bdi></a>, and <strong>All</strong>,</p>
<p dir="auto">First, <strong>thanks</strong> for your <strong>exact</strong> description of your problem :-))</p>
<p dir="auto">Ah… I see ! My regexes described in <strong>previous</strong> posts, of this topic, are <strong>useless</strong>, in your case, because you may <strong>not</strong> have the <strong>same</strong> number of lines, between your criterion <strong><code>GENDER= MALE</code></strong> and the end of the <strong>current</strong> section <strong><code>ENDDATA:</code></strong>. The previous regex examples are <strong>line-oriented</strong> ( because of the <strong><code>(?-is)</code></strong> syntax ) and catch an <strong>exact amount</strong> of lines !</p>
<p dir="auto">In your case, we must use the <strong>no-single</strong> line concept, so the syntax <strong><code>(?s-i)</code></strong>, which allows the regex <strong>engine</strong> to consider that the <strong>dot</strong> regex symbol <strong><code>.</code></strong> matches <strong>absolutely</strong> any <strong>single</strong> character, including <strong>EOL</strong> chars. In other words, the regex will be able to match any <strong>multi-lines</strong> range of text !</p>
<hr />
<p dir="auto">Then, if we assume that the line <strong><code>GENDER=.....</code></strong> comes <strong>right after</strong> the line <strong><code>STARTDATA:</code></strong>, the following regex could be the <strong>right</strong> one !</p>
<p dir="auto">SEARCH <strong><code>(?s-i)^STARTDATA:\RGENDER=MALE.+?^ENDDATA:</code></strong></p>
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">I suppose that the search is <strong>sensible</strong> to case. If <em>NOT</em>, simply change the <strong>beginning</strong> of the regex as <strong><code>(?si)</code></strong></p>
</li>
<li>
<p dir="auto">Now, it looks for any line <strong><code>STARTDATA:</code></strong>, <strong>beginning</strong> a line ( <strong><code>^</code></strong> ), followed with its <strong>line-break</strong> ( <strong><code>\R</code></strong> ) and the line <strong><code>GENDER=MALE</code></strong></p>
</li>
<li>
<p dir="auto">Then the part <strong><code>.+?</code></strong> tries to match the <strong>shortest non-null</strong> range of <strong>any</strong> character, till the line <strong><code>ENDDATA:</code></strong>, <strong>beginning</strong> a line ( <strong><code>^</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong>All</strong> lines, even <strong>partially</strong>, involved in the match, are then <strong>bookmarked</strong></p>
</li>
</ul>
<hr />
<p dir="auto"><strong>Remark</strong> : In case the line <strong><code>GENDER=.....</code></strong> is <strong>preceded</strong> with a <strong>fix</strong> or <strong>variable</strong> amount of line(s), even <strong>empty</strong>, use the <strong>generic</strong> regex :</p>
<p dir="auto">SEARCH <strong><code>(?s-i)^STARTDATA:\R(?-s:.*\R){</code>N<code>,</code>M<code>} GENDER=MALE.+?^ENDDATA:</code></strong></p>
<p dir="auto">For instance, if we suppose this <strong>initial</strong> text :</p>
<pre><code class="language-z">STARTDATA:
11111

3333
GENDER=MALE
NAME=JOE
AGE=34
HEIGHT=181
ENDDATA:
STARTDATA:
GENDER=FEMALE
NAME=MARIA
AGE=38
HEIGHT=163
ENDDATA:
STARTDATA:
GENDER=MALE
NAME=JOHN
AGE=37
HEIGHT=197
WEIGHT=105
ENDDATA:
STARTDATA:
GENDER=FEMALE
NAME=DIANA
AGE=56
HEIGHT=150
ENDDATA:
STARTDATA:
1111
2222
GENDER=MALE
NAME=KEVIN
AGE=21
HEIGHT=201
WEIGHT=97
ENDDATA:
</code></pre>
<hr />
<p dir="auto">The regex :</p>
<p dir="auto"><strong><code>(?s-i)^STARTDATA:\R(?-s:.*\R){0,3}GENDER=MALE.+?^ENDDATA:</code></strong></p>
<p dir="auto"><strong>correctly</strong> mark the sections, <strong>containing</strong> the line <strong><code>GENDER=MALE</code></strong>, if it exists from <strong><code>0</code></strong> to <strong><code>3</code></strong> lines <strong>between</strong> a line <strong><code>STARTDATA:</code></strong> and <strong>its</strong> line <strong><code>GENDER=MALE</code></strong></p>
<p dir="auto"><strong>Note</strong> :</p>
<ul>
<li>
<p dir="auto">The part <strong><code>(?-s:</code></strong> begins a <strong>non-capturing</strong> group and any <strong>dot</strong> regex symbol, <strong>inside</strong> this non-capturing group, will match a <strong>single standard</strong> char ( <em>not</em> <strong>EOL</strong> ones )</p>
</li>
<li>
<p dir="auto">The part <strong><code>{0,3}</code></strong> matches from <strong><code>0</code></strong> to <strong><code>3</code></strong> <strong>complete</strong> lines, with their <strong>line-break(s)</strong> <strong><code>.*\R</code></strong>, located <strong>before</strong> the line <strong><code>GENDER=MALE</code></strong></p>
</li>
</ul>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51060</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51060</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 29 Feb 2020 11:24:20 GMT</pubDate></item></channel></rss>