<?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[Search and extract results between two strings in multiple files]]></title><description><![CDATA[<p dir="auto">Hello Everyone,</p>
<p dir="auto">I am trying to search and extract results between two strings in multiple files.</p>
<p dir="auto">for example<br />
i need to search string “Assign” between ‘PROCEDURE INIT-RECORD’ and ‘END PROCEDURE’, something like below</p>
<p dir="auto">PROCEDURE INIT-RECORD</p>
<p dir="auto">DEFINE variable a;<br />
DEFINE variable b;<br />
DEFINE variable c;</p>
<p dir="auto">Assign a = 4;</p>
<p dir="auto">Assign b = 6;</p>
<p dir="auto">c = a + b;<br />
END PROCEDURE</p>
<p dir="auto">the search results should retrieve<br />
Assign a = 4, and<br />
Assign b = 6.</p>
<p dir="auto">and similar Assign statements across multiple files within the PROCEDURE INIT-RECORD.</p>
<p dir="auto">i tried NPP search using<br />
(?s)(?&lt;=PROCEDURE INIT-RECORD)(.+?)(?&lt;=END PROCEDURE)</p>
<p dir="auto">the above regex search string selects the target procedure but i cannot copy the text from all the results.</p>
<p dir="auto">Any help/pointers/ideas here will be appreciated.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/24333/search-and-extract-results-between-two-strings-in-multiple-files</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 22:50:15 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/24333.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 04 Apr 2023 10:18:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Search and extract results between two strings in multiple files on Wed, 05 Apr 2023 09:23:58 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> ,</p>
<p dir="auto">My bad,  i misinterpreted your reply and went into a different direction.<br />
(also had to upgrade my NPP (upgraded to v8.4.9) to reflect ‘Copy Marked text’ option".</p>
<p dir="auto">I have now achieved what is required.</p>
<p dir="auto">Here are the steps which i followed</p>
<ul>
<li>Search for Regex String  ‘PROCEDURE INIT-RECORD|ASSIGN|END PROCEDURE’ across the files</li>
<li>Copied the search result in a new window</li>
<li>Applied regex search string provided by you in the earlier reply’ and followed the provided steps</li>
<li>All the target keywords within the target procedure were marked</li>
<li>Used ‘Copy Marked Text’ option and got my results</li>
</ul>
<p dir="auto">Thanks a lot for your help.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85498</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85498</guid><dc:creator><![CDATA[Amit Pandey]]></dc:creator><pubDate>Wed, 05 Apr 2023 09:23:58 GMT</pubDate></item><item><title><![CDATA[Reply to Search and extract results between two strings in multiple files on Wed, 05 Apr 2023 08:34:28 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/amit-pandey" aria-label="Profile: amit-pandey">@<bdi>amit-pandey</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> and <strong>All</strong>,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/amit-pandey" aria-label="Profile: amit-pandey">@<bdi>amit-pandey</bdi></a>, you said :</p>
<blockquote>
<p dir="auto">Although I still cannot get all the search results but i got a good perspective on my search results</p>
</blockquote>
<p dir="auto">This means that your <strong>initial</strong> example is totally <strong>insufficient</strong> and that we need some other blocks <strong><code>PROCEDURE INIT-RECORD ....... END PROCEDURE</code></strong>  that allow us to build the <strong>appropriate</strong> regex which will match all the <strong>expected</strong> results !</p>
<p dir="auto">So, just add a <strong>longer</strong> exemple, which describe <strong>most</strong> of the cases which may occur, using the <strong><code>&lt;/&gt;</code></strong> function, in your answer !</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85495</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85495</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 05 Apr 2023 08:34:28 GMT</pubDate></item><item><title><![CDATA[Reply to Search and extract results between two strings in multiple files on Wed, 05 Apr 2023 02:21:20 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</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">Thanks for your time in looking into this.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a>  , the file volume is huge hence working this out for one file at a time is a challenge.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> , the regex search string did the trick, i used it in ‘Find in Files’ option.<br />
The search results are giving me the first instance of the target string within the target procedure.<br />
The results are far much better than what i was getting earlier with my search efforts.</p>
<p dir="auto">Although I still cannot get all the search results but i got a good perspective on my search results</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85490</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85490</guid><dc:creator><![CDATA[Amit Pandey]]></dc:creator><pubDate>Wed, 05 Apr 2023 02:21:20 GMT</pubDate></item><item><title><![CDATA[Reply to Search and extract results between two strings in multiple files on Tue, 04 Apr 2023 12:34:55 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/amit-pandey" aria-label="Profile: amit-pandey">@<bdi>amit-pandey</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> and <strong>All</strong>,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/amit-pandey" aria-label="Profile: amit-pandey">@<bdi>amit-pandey</bdi></a>, I suppose your need this regex <a href="https://community.notepad-plus-plus.org/topic/22690/generic-regex-replacing-in-a-specific-zone-of-text">technique</a></p>
<p dir="auto">If we adapt this <strong>generic</strong> regex to your <strong>specific</strong> problem, we end with that <strong>functional</strong> regex :</p>
<p dir="auto">MARK <strong><code>(?-i:PROCEDURE INIT-RECORD|(?!\A)\G)(?s-i:(?!END PROCEDURE).)*?\K(?-si:Assign.+)</code></strong></p>
<hr />
<p dir="auto">So :</p>
<ul>
<li>
<p dir="auto">Open your file in Notepad++</p>
</li>
<li>
<p dir="auto">Move the cursor to its <strong>very beginning</strong></p>
</li>
<li>
<p dir="auto">Open the <strong>Mark</strong> dialog ( <strong><code>Ctrl+ M</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong>Untick</strong> <em>ALL</em> box options</p>
</li>
<li>
<p dir="auto">Check the <strong><code>3</code></strong> options <strong><code>Bookmark line</code></strong>, <strong><code>Purge for each serch</code></strong> and <strong><code>Wrap around</code></strong></p>
</li>
<li>
<p dir="auto">Select the <strong><code>Regular expression</code></strong> search <strong>mode</strong></p>
</li>
<li>
<p dir="auto">Click on the <strong><code>MArk All</code></strong> button</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Copy Marked Text</code></strong> button</p>
</li>
<li>
<p dir="auto">Open a <strong>new</strong> tab ( <strong><code>Ctrl + N</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong>Paste</strong> The <strong><code>Mark</code></strong> contents ( <strong><code>Ctrl + V</code></strong> )</p>
</li>
</ul>
<p dir="auto">Here you are !</p>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85467</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85467</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 04 Apr 2023 12:34:55 GMT</pubDate></item><item><title><![CDATA[Reply to Search and extract results between two strings in multiple files on Tue, 04 Apr 2023 11:22:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/amit-pandey" aria-label="Profile: Amit-Pandey">@<bdi>Amit-Pandey</bdi></a> said in <a href="/post/85463">Search and extract results between two strings in multiple files</a>:</p>
<p dir="auto">Your regex seems ok, as a first step.<br />
But use the <em>Mark All</em> function followed by <em>Copy Marked Text</em> and paste into a new N++ tab.<br />
That way, in the new tab you have <code>Assign</code> data that only occurs between the specified delimiters; all others will not be in the new tab.<br />
Then you can do a similar regex <em>Mark</em> operation for <code>Assign</code>.<br />
I think you know where to go from there.</p>
<blockquote>
<p dir="auto">search and extract results between two strings in multiple files.</p>
</blockquote>
<p dir="auto">You will need to do the files one at a time, manually.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85465</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85465</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 04 Apr 2023 11:22:29 GMT</pubDate></item></channel></rss>