<?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[Regex: Parsing, How to make a regex replacement in multiple files, from Folder-1 to Folder-2]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1613194141263-ultima-copy.png" alt="ultima-copy.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">hello, the image will explain what I want to do. I have a lot of html files in Folder-1 and the same number of files in Folder-2. The name of the files is the same on both folders, only the content of them is different. As you can see in this image what I want to do is to copy the lines from <strong>&lt;!–START–&gt;</strong> to <strong>&lt;!–FINNISH --&gt;</strong> and paste them to other files from second folder, in html files, in the point <strong>PUT-HERE-THE-CODE</strong></p>
<p dir="auto">You have to know that the content of <strong>&lt;!–START–&gt;</strong> to <strong>&lt;!–FINNISH --&gt;</strong> is different on all pages, so only this 2 words are repeated in all files, the links are different. And in the Folder-2, the only part that repeats in all files is <strong>PUT-HERE-THE-CODE</strong></p>
<p dir="auto">SOLUTION. I made a regex for this task: This will select the lines between <code>&lt;!--START--&gt;</code> to <code>&lt;!--FINNISH --&gt;</code></p>
<p dir="auto">FIND: <code>(?s)(&lt;\!--START--&gt;).*(&lt;\!--FINNISH --&gt;)</code></p>
<p dir="auto">But how can I move this content in other files, from Folder-1 to Folder-2 to other file over the word <code>PUT-HERE-THE-CODE</code> ?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/20737/regex-parsing-how-to-make-a-regex-replacement-in-multiple-files-from-folder-1-to-folder-2</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 16:01:35 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20737.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 13 Feb 2021 05:37:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Regex: Parsing, How to make a regex replacement in multiple files, from Folder-1 to Folder-2 on Sun, 14 Feb 2021 00:25:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vasile-caraus" aria-label="Profile: Vasile-Caraus">@<bdi>Vasile-Caraus</bdi></a></p>
<p dir="auto">A viable technique, although not a technique inside Notepad++.</p>
<p dir="auto">I think your technique is going to also copy over the “START” and “FINNISH” lines into the destination file, which, to the OP, may not be desirable.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62836</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62836</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 14 Feb 2021 00:25:32 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Parsing, How to make a regex replacement in multiple files, from Folder-1 to Folder-2 on Sat, 13 Feb 2021 14:37:37 GMT]]></title><description><![CDATA[<p dir="auto">I don’t know if it can be done just with regex and notepad++. Maybe in the future. I know that in Sublime-Text this task can be done with a plugin made in Python.</p>
<p dir="auto">But, instead, you can use very easy <strong>PowerShell</strong> for this task.</p>
<p dir="auto">This solution is very simple. Just copy this code in <strong>PowerShell</strong> from Windows10</p>
<pre><code>$sourceFiles = Get-ChildItem 'c:\Folder1'  
$destinationFolder = 'c:\Folder2'

foreach ($file in $sourceFiles) {

$sourceContent = Get-Content $file.FullName -Raw
$contentToInsert = [regex]::match($sourceContent,"(?ms)&lt;!--START--&gt;(.+)&lt;!--FINNISH --&gt;").value
$destinationContent = Get-Content $destinationFolder\$($file.Name) -Raw
$destinationContent = $destinationContent -replace 'PUT-HERE-THE-CODE',$contentToInsert

Set-Content -Path $destinationFolder\$($file.Name) -Value $destinationContent -Encoding UTF8

} #end foreach file
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/62828</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62828</guid><dc:creator><![CDATA[Vasile Caraus]]></dc:creator><pubDate>Sat, 13 Feb 2021 14:37:37 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Parsing, How to make a regex replacement in multiple files, from Folder-1 to Folder-2 on Sat, 13 Feb 2021 12:37:53 GMT]]></title><description><![CDATA[<p dir="auto">yes, all files from <strong>Folder-1</strong> have the same block <code>&lt;!–START–&gt; •••••• &lt;!–FINNISH --&gt;</code> but with different content. And all files from <strong>Folder-2</strong> have the same word/line <code>PUT-HERE-THE-CODE</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/62826</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62826</guid><dc:creator><![CDATA[Robin Cruise]]></dc:creator><pubDate>Sat, 13 Feb 2021 12:37:53 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Parsing, How to make a regex replacement in multiple files, from Folder-1 to Folder-2 on Sat, 13 Feb 2021 10:37:14 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/robin-cruise" aria-label="Profile: robin-cruise">@<bdi>robin-cruise</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I did <strong>not</strong> investigate, yet but I thought of some <strong>points</strong> :</p>
<ul>
<li>
<p dir="auto">Are there <strong>several</strong> <strong><code>PUT-HERE-THE-CODE</code></strong> lines in the files, located in <strong>Folder-2</strong> ? In other words, do you have to <strong>paste</strong> the  <strong><code>&lt;!–START–&gt; •••••• &lt;!–FINNISH --&gt;</code></strong> block in <strong>several</strong> locations of a <strong>same</strong> file ?</p>
</li>
<li>
<p dir="auto">Are there <strong>several</strong> <strong><code>&lt;!–START–&gt; •••••• &lt;!–FINNISH --&gt;</code></strong> blocks in files, located in <strong>Folder-1</strong> ? I suppose <strong>not</strong> because your regex would <strong>not</strong> match these sections <strong>properly</strong> and you would need <strong>several</strong> marks as <strong><code>PUT-HERE-THE-CODE_1</code></strong>, <strong><code>PUT-HERE-THE-CODE_2</code></strong> and so on…</p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62823</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62823</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 13 Feb 2021 10:37:14 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Parsing, How to make a regex replacement in multiple files, from Folder-1 to Folder-2 on Sat, 13 Feb 2021 07:46:45 GMT]]></title><description><![CDATA[<p dir="auto">to make an idea, should be something like:</p>
<p dir="auto">FIND: <code>(?s)(START).*(FINNISH) \ Folder-1</code><br />
Replace on: <code>$1 PUT-HERE-THE-CODE $2 \ Folder-2</code></p>
<p dir="auto">Is it possible with notepad++ ?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62822</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62822</guid><dc:creator><![CDATA[Robin Cruise]]></dc:creator><pubDate>Sat, 13 Feb 2021 07:46:45 GMT</pubDate></item></channel></rss>