<?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[I want to compare two files and bookmark the lines containing similar words]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I want to compare two files and bookmark the lines containing similar words, for example:<br />
file1.txt</p>
<p dir="auto">Ahmed:12321<br />
Ali:22432<br />
Khalid:567643</p>
<p dir="auto">file2.txt</p>
<p dir="auto">Ahmed<br />
Ali</p>
<p dir="auto">I found a method that could be used here but the lines have to be identical for it to work.<br />
Basically, you should go to the bottom of file1 and put ##### then paste the contents of file two and press ctrl M and use this regex (?-s)^(.+\R)(?=(?s).<em>#####.</em>?\1) with the search mode regular expressions and “bookmark line” box checked then clicking mark all.<br />
If you have knowledge in regular expressions please help me to make it exclude whatever after the : and only compare whatever is before it to file2 contents.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/21882/i-want-to-compare-two-files-and-bookmark-the-lines-containing-similar-words</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 23:44:21 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/21882.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 25 Sep 2021 03:29:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to I want to compare two files and bookmark the lines containing similar words on Sat, 25 Sep 2021 23:21:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bader-alharbi" aria-label="Profile: Bader-Alharbi">@<bdi>Bader-Alharbi</bdi></a> said in <a href="/post/70022">I want to compare two files and bookmark the lines containing similar words</a>:</p>
<blockquote>
<p dir="auto">is there a regex to add the line number  in multiple places in the line?</p>
</blockquote>
<p dir="auto">Regular expressions cannot count (they have no concept of “increment a number”).  Your two options inside Notepad++ are using the Column Editor like you’ve already discovered, or using a scripting plugin like PythonScript and using the full power of a programming language to influence the text in the open file.  (I actually just answered a question <a href="/topic/21883">earlier today</a> on that same concept.)</p>
<blockquote>
<p dir="auto">apply it to different files with a different number of lines.</p>
</blockquote>
<p dir="auto">as linked in that other topic (and the links refenced there), you can make a macro that will do the begin/end-select for column mode… and if you combined that with other controls, like the <code>Ctrl+Home</code> to go to the start of the file, and <code>Ctrl+End</code> to go to the end, you could have a macro that does the zeroeth-column select in the macro, then manually type <code>Alt+C</code> to bring up the column editor and insert the numbers, then you could use another regex (using multiple capture groups) to distribute the number from the beginning of the line to the various locations throughout the line that you need</p>
]]></description><link>https://community.notepad-plus-plus.org/post/70026</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/70026</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sat, 25 Sep 2021 23:21:27 GMT</pubDate></item><item><title><![CDATA[Reply to I want to compare two files and bookmark the lines containing similar words on Sat, 25 Sep 2021 23:08:35 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 />
I tried the one you posted, and it works too. Thank you.<br />
Please let me know if you can help me with the other question I mentioned in my earlier reply? I would appreciate it.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/70025</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/70025</guid><dc:creator><![CDATA[Bader Alharbi]]></dc:creator><pubDate>Sat, 25 Sep 2021 23:08:35 GMT</pubDate></item><item><title><![CDATA[Reply to I want to compare two files and bookmark the lines containing similar words on Sat, 25 Sep 2021 22:56:46 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a><br />
That worked perfectly for me. Thanks a lot.<br />
I still have one more question, is there a regex to add the line number  in multiple places in the line?<br />
For example, if I want to use it like this<br />
mkvmerge -o “line number”.mkv “line number”.mp4 “line number”.srt<br />
mkvmerge -o “line number”.mkv “line number”.mp4 “line number”.srt<br />
mkvmerge -o “line number”.mkv “line number”.mp4 “line number”.srt</p>
<p dir="auto">I’m doing it now using the column editor but I’d like to use it in a macro and apply it to different files with a different number of lines.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/70022</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/70022</guid><dc:creator><![CDATA[Bader Alharbi]]></dc:creator><pubDate>Sat, 25 Sep 2021 22:56:46 GMT</pubDate></item><item><title><![CDATA[Reply to I want to compare two files and bookmark the lines containing similar words on Sat, 25 Sep 2021 19:11:14 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/bader-alharbi" aria-label="Profile: bader-alharbi">@<bdi>bader-alharbi</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> and <strong>All</strong>;</p>
<p dir="auto">Here is a general solution which marks <strong>every</strong> word of <strong><code>File 1</code></strong> <em>ONLY IF</em> this <strong>specific</strong> word is <strong>also</strong> present in <strong><code>File 2</code></strong> :</p>
<p dir="auto">MARK <strong><code>(?s-i)\b(\w+)\b(?=.+#####.+?\b\1\b)</code></strong></p>
<p dir="auto">So, for instance, from this <strong>initial</strong> text :</p>
<pre><code class="language-diff">Ahmed:12321
12345,56789
Ali:22432
Khalid:567643
Alone sentence
Queen Elisabeth
This is a 789 test
ali
Mary Thompson
#####
Ahmed
Mary	789
Elisabeth
567643
test,a is:This
</code></pre>
<p dir="auto">You would obtain, after the <strong>Mark</strong> process :</p>
<p dir="auto"><strong><code>Ahmed</code></strong>:12321<br />
12345,56789<br />
Ali:22432<br />
Khalid:<strong><code>567643</code></strong><br />
Alone sentence<br />
Queen <strong><code>Elisabeth</code></strong><br />
<strong><code>This</code></strong> <strong><code>is</code></strong> <strong><code>a</code></strong>	<strong><code>789</code></strong> <strong><code>test</code></strong><br />
ali<br />
<strong><code>Mary</code></strong> Thompson<br />
#####<br />
Ahmed<br />
Mary	789<br />
Elisabeth<br />
567643<br />
test,a is:This</p>
<hr />
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>The words in <strong><code>File 2</code></strong> can be in <strong>any</strong> order ;-)) I could have used :</li>
</ul>
<pre><code class="language-z">#####
Mary	789 Ahmed
Elisabeth
567643
test
a
is!This
</code></pre>
<p dir="auto">or even :</p>
<pre><code class="language-z">#####
Mary,a,789,is,Ahmed,Elisabeth,This,567643,test
</code></pre>
<hr />
<ul>
<li>
<p dir="auto">The present search is <strong>sensitive</strong> to case. If you prefer to search <strong>identical</strong> words, <strong>whatever</strong> their case, change the <strong>beginning</strong> of the regex from <strong><code>(?s-i)</code></strong> to <strong><code>(?si)</code></strong></p>
</li>
<li>
<p dir="auto">By <strong>default</strong>, the part <strong><code>\b(\w+)\b</code></strong> looks for the <strong>greatest</strong> range of <strong>word</strong> characters, between <strong><code>2</code></strong> <strong>non-word</strong> chars. And a <strong>word</strong> character represents any single <strong>letter</strong>, <strong>accentuated</strong> letter, <strong>digit</strong> or the <strong><code>_</code></strong> character. If you want to modify or <strong>add</strong> other characters to be considered as <strong>words</strong>, just go to <strong><code>Settings &gt; Preferences... &gt; Delimiter &gt; Word character list</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/70018</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/70018</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 25 Sep 2021 19:11:14 GMT</pubDate></item><item><title><![CDATA[Reply to I want to compare two files and bookmark the lines containing similar words on Sat, 25 Sep 2021 16:58:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bader-alharbi" aria-label="Profile: Bader-Alharbi">@<bdi>Bader-Alharbi</bdi></a> said in <a href="/post/70007">I want to compare two files and bookmark the lines containing similar words</a>:</p>
<blockquote>
<p dir="auto"><code>(?-s)^(.+\R)(?=(?s).*#####.*?\1)</code></p>
</blockquote>
<p dir="auto">Change the <code>(.+\R)</code> to <code>(.+?:).*?\R</code> – everything else should stay the same</p>
<p dir="auto"><img src="/assets/uploads/files/1632589093931-d4506fcd-8353-4bb0-a101-9d10ea1c64ac-image.png" alt="d4506fcd-8353-4bb0-a101-9d10ea1c64ac-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/70016</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/70016</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sat, 25 Sep 2021 16:58:17 GMT</pubDate></item></channel></rss>