<?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[Bookmark multi words from multi lines in a text]]></title><description><![CDATA[<p dir="auto">Hello , i need some help with bookmark lines if they contains a part words</p>
<p dir="auto">for example i am searching inside a text file that contains 2 lines</p>
<p dir="auto">TEST1/e37845R2b11ecbf0ade4<br />
TEST2/guTiuh76iuh7TFuhOIHJD</p>
<p dir="auto">I want to find and bookmark all lines that contains<br />
11ecbf0ade4<br />
7TFuhOIHJD</p>
<p dir="auto">which is a part of the 2 lines above ? is it possible ? if not is possible anywhere else ?</p>
<p dir="auto">thanks in advance.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/19249/bookmark-multi-words-from-multi-lines-in-a-text</link><generator>RSS for Node</generator><lastBuildDate>Tue, 19 May 2026 04:29:40 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19249.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 18 Apr 2020 06:48:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Tue, 20 Dec 2022 22:51:42 GMT]]></title><description><![CDATA[<p dir="auto">The marker ID used for bookmarks changed in Notepad++ 8.4.6 (and later).  It is now 20, instead of 24.  So, all references to 24 in this thread and/or its script(s), should be changed to 20.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82618</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82618</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 20 Dec 2022 22:51:42 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Thu, 10 Dec 2020 04:28:19 GMT]]></title><description><![CDATA[<p dir="auto">Hello,<a class="plugin-mentions-user plugin-mentions-a" href="/user/baz-bazooo" aria-label="Profile: BAZ-BAZOOO">@<bdi>BAZ-BAZOOO</bdi></a><br />
Please follow this information, To Bookmark multi words from multi lines in a text</p>
<p dir="auto"><strong>Find What:</strong><br />
<strong>(.<em>Query .</em> message.<em>\R.<em>ApplicationGatewayID = 5009.</em>\R.</em>\R.<em>\R)|^(?!.<em>Query .</em> message).</em>\R?</strong><br />
<strong>Replace With:</strong><br />
<strong>$1</strong></p>
<p dir="auto">The regex is of the form:** (&lt;YOUR_REGEX_MATCHING_LINES&gt;)|^(?!.<em>&lt;STARTING_PART_OF_REGEX&gt;).</em>\R?.**</p>
<p dir="auto"><strong>Description:</strong></p>
<ul>
<li>
<p dir="auto">(.<em>Query .</em> message.<em>\R.<em>ApplicationGatewayID = 5009.</em>\R.</em>\R.*\R) - a line with Query and then message words on it, then the next line that has ApplicationGatewayID = 5009 on it and then 2 more lines, captured into Group 1 ($1 refers to this value)</p>
</li>
<li>
<p dir="auto">| - or</p>
</li>
<li>
<p dir="auto">^(?!.<em>Query .</em> message).*\R? - start of a line (^) that has no Query and then message on it, then the whole line and optional linebreak after it are matched and eventually removed.</p>
</li>
</ul>
<p dir="auto">I hope this information will be useful to you.<br />
Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60668</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60668</guid><dc:creator><![CDATA[prahladmifour]]></dc:creator><pubDate>Thu, 10 Dec 2020 04:28:19 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Wed, 09 Dec 2020 20:11:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> said in <a href="/post/60647">Bookmark multi words from multi lines in a text</a>:</p>
<blockquote>
<p dir="auto">did you reproduce the issue, too, when focus is in the analyzed text view ?</p>
</blockquote>
<p dir="auto">Mostly it worked okay for me on simpler data sets.<br />
But I noticed it as an issue when I was looking into a larger-dataset problem, e.g. <a href="https://community.notepad-plus-plus.org/topic/20443/deleting-numbers-from-list-1-that-also-appear-in-list-2/18">THIS ONE</a>, and that made me recall an issue where an indicator needs to be set right before a fill, even though the indicator was set earlier and still should remain set.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60648</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60648</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 09 Dec 2020 20:11:19 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Wed, 09 Dec 2020 20:07:15 GMT]]></title><description><![CDATA[<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>,</p>
<p dir="auto">BINGO ! It works like a charm, <strong>whatever</strong> the <strong>focus</strong> is ( The <strong>main</strong> or the <strong>secondary</strong> view )  ;-))</p>
<p dir="auto">You’re <strong>right</strong> : placing the <strong>indicator</strong>’s definition <strong>inside</strong> the loop is the <strong>key</strong> point !</p>
<p dir="auto">Many <strong>thanks</strong>, again, for your cooperation :)</p>
<p dir="auto">Just to be sure : did you <strong>reproduce</strong> the issue, too, when <strong>focus</strong> is in the <strong>analyzed</strong> text view ?</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60647</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60647</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 09 Dec 2020 20:07:15 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Wed, 09 Dec 2020 19:28:11 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></p>
<p dir="auto">I think I remember something about possibly Notepad++ code itself interfering with scripts that are trying to use indicators?</p>
<p dir="auto">Perhaps the code in the script that “selects” an indicator needs to be “tighter” to where the indicator is used?</p>
<p dir="auto">Maybe try changing these lines of the script:</p>
<pre><code class="language-z">            editor1.setIndicatorCurrent(SCE_UNIVERSAL_FOUND_STYLE)
            for m in matches:
                editor1.indicatorFillRange(m[0], m[1] - m[0])
</code></pre>
<p dir="auto">to this instead, and see if it runs differently?:</p>
<pre><code class="language-z">            for m in matches:
                editor1.setIndicatorCurrent(SCE_UNIVERSAL_FOUND_STYLE)
                editor1.indicatorFillRange(m[0], m[1] - m[0])
</code></pre>
<p dir="auto">(really what this means is just moving the “setting” of the indicator inside the loop, so that it is definitely set each time before a range is “filled” with it)</p>
<p dir="auto">Let me know how that goes.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60646</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60646</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 09 Dec 2020 19:28:11 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Wed, 09 Dec 2020 18:48:32 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <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">For instance, with :</p>
<ul>
<li>
<p dir="auto">Your text pasted, in <strong><code>new 1</code></strong>, in the <strong>main</strong> view</p>
</li>
<li>
<p dir="auto">A list of <strong>four</strong> first names, pasted in <strong><code>new 2</code></strong>, in the <strong>secondary</strong> view</p>
</li>
<li>
<p dir="auto">Cursor at the <strong>very beginning</strong> of <strong><code>new 1</code></strong></p>
</li>
<li>
<p dir="auto">Focus on <strong><code>new 1</code></strong> ( the <strong>text</strong> )</p>
</li>
</ul>
<p dir="auto"><strong>After</strong> running the script, I got :</p>
<p dir="auto"><img src="/assets/uploads/files/1607539220912-802b7bb5-52fb-42a3-8a5e-2305207a0592-image.png" alt="802b7bb5-52fb-42a3-8a5e-2305207a0592-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">As you can see, <strong>all</strong> bookmarks are here, but some <strong>red marks</strong> are missing ! The script seems to <strong>only</strong> <strong><code>red-mark</code></strong> the <strong>first</strong> occurrence of <strong>each</strong> word of the list !</p>
<hr />
<p dir="auto">In contrast to :</p>
<ul>
<li>
<p dir="auto">Your text, pasted in <strong><code>new 1</code></strong>, in the <strong>main</strong> view</p>
</li>
<li>
<p dir="auto">A list of <strong>four</strong> first names, pasted in <strong><code>new 2</code></strong>, in the <strong>secondary</strong> view</p>
</li>
<li>
<p dir="auto">Cursor at the <strong>very beginning</strong> of <strong><code>new 2</code></strong></p>
</li>
<li>
<p dir="auto">Focus on <strong><code>new 2</code></strong> ( the <strong>list</strong> )</p>
</li>
</ul>
<p dir="auto"><strong>After</strong> running the script, I got :</p>
<p dir="auto"><img src="/assets/uploads/files/1607539323903-a232e225-5cb0-43e9-a112-3392840f8378-image.png" alt="a232e225-5cb0-43e9-a112-3392840f8378-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">This time, everything went <strong>fine</strong> !</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60645</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60645</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 09 Dec 2020 18:48:32 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Wed, 09 Dec 2020 13:45:49 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></p>
<p dir="auto">So somewhere between writing the first version of the script, and the changing of it to create the second script, I decided that it made sense to <em>require</em> that the “data” file you want the markings to be shown in should be the active file in the <em>primary</em> view, and the “list” file of tokens/regexes that should be used to do the markings should be the active file in the <em>secondary</em> view, when the script is run.  It is an unwritten requirement (except that I just wrote it!).</p>
<p dir="auto">The first version of the script, because it was simpler and only one “word” was expected per line in the “list” file, tried to determine which view contained which.</p>
<p dir="auto">Aside from that, with the second version of the script, I’m not seeing the problems you mention.  Can you give an exact example that replicates the behavior?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60629</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60629</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 09 Dec 2020 13:45:49 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Wed, 09 Dec 2020 09:32:47 GMT]]></title><description><![CDATA[<p dir="auto">Hello <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">So, magically, the <strong>second</strong> version of your script seems to work <strong>better</strong>, this morning ;-))</p>
<p dir="auto">However, there’s still this <strong>minor</strong> bug, as I said in my <strong>previous</strong> post :</p>
<ul>
<li>If the focus is on the file being <strong>analyzed</strong>, the script <strong>correctly</strong> bookmarks <strong>all</strong> the lines where the zones belong but, strangely, it <strong><code>red</code></strong>-marks, only, the <strong>first two</strong> matches as with your <strong><code>1st</code></strong> script !?</li>
</ul>
<p dir="auto">Surely a matter of minutes to get it <strong>right</strong> !</p>
<p dir="auto">Note that I <strong>can</strong> live with this : we just have to remember to <strong>focus</strong> on the view contening the <strong>list</strong> of <strong><code>words/regexes</code></strong>, <strong>before</strong> running your <strong>Python</strong> script !</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60626</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60626</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 09 Dec 2020 09:32:47 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Wed, 09 Dec 2020 00:14:51 GMT]]></title><description><![CDATA[<p dir="auto">Hi, @alan-kilobrn and <strong>All</strong>,</p>
<p dir="auto">Many <strong>thanks</strong> for this <strong>new enhanced</strong> version !</p>
<p dir="auto"><strong>Before</strong> speaking about my tests of your <strong><code>2nd</code></strong> try, I re-read <strong>all</strong> the discussion and tried to play with your <strong>first</strong> version !</p>
<ul>
<li>So, regarding this <strong>first</strong> version :</li>
</ul>
<p dir="auto">I decided to search for the word <strong><code>license</code></strong>, <strong><code>program</code></strong> and <strong><code>version</code></strong> in the N++ <strong><code>license.txt</code></strong> file. And, strangely, I did <strong>not</strong> get all the <strong>expected</strong> matches ! After a while I understood that you <strong>must</strong> have the <strong>focus</strong> on the file containing the <strong>list</strong> of words ( which are searched in the <strong>current</strong> file of the <strong>other</strong> view ). In that case, the results are quite <strong>correct</strong> !</p>
<p dir="auto">But if the <strong>focus</strong> is on the file being <strong>analyzed</strong>, the script seems to match only the <strong>first two</strong> matches ?!</p>
<hr />
<p dir="auto">Now, regarding your <strong>second</strong> version :</p>
<ul>
<li>
<p dir="auto">Thanks, first, for <strong>bookmarking</strong> all the lines containing the <strong>matches</strong></p>
</li>
<li>
<p dir="auto">Thanks also the possibility to search for <strong>multiple</strong>-words expressions such as <strong><code>Bob and Carol</code></strong> or, even, <strong>complete</strong> sentences !</p>
</li>
<li>
<p dir="auto">Finally, thanks for supporting the <strong>regex</strong> expressions. For instance, if you have a <strong>one-line</strong> file containing <strong><code>Bob.*?Carol</code></strong>, it would mark, in the <strong>current</strong> file of the <strong>other</strong> view, all the <strong>smallest</strong> ranges of characters beginning with <strong><code>Bob</code></strong> till <strong><code>Carol</code></strong>, with this <strong>exact</strong> case !</p>
</li>
<li>
<p dir="auto">Note that the Python search is <strong>sensible</strong> to case, by <strong>default</strong> and does <strong>not</strong> care about the <strong>whole word</strong> notion. So :</p>
<ul>
<li>
<p dir="auto">To run a search <strong>insensible</strong> to <strong>case</strong>, just <strong>prefix</strong> your regex or expression with the <strong><code>(?i)</code></strong> <strong>modifier</strong></p>
</li>
<li>
<p dir="auto">To run a search which matches only <strong>whole</strong> words, surround your expression with the <strong><code>\b</code></strong> assertion. For instance, the <strong>regex</strong> search <strong><code>\bted\b</code></strong>  would find the first name <strong><code>ted</code></strong> but not the string <strong><code>ted</code></strong> in the word <strong><code>deleted</code></strong></p>
</li>
</ul>
</li>
</ul>
<hr />
<p dir="auto">Now, <strong>Alan</strong>, I’m <strong>sorry</strong> but it’s time to talk about some <strong>inconveniences</strong> ! I take up your text with <strong>Bob</strong>, <strong>Carol</strong>, <strong>Ted</strong> and <strong>Alice</strong> :</p>
<p dir="auto">Imagine I have this <strong>two-lines</strong> list :</p>
<p dir="auto"><strong><code>\bBob.{2,20}Carol\b</code></strong><br />
<strong><code>\bTed.{2,20}Alice\b</code></strong></p>
<ul>
<li>
<p dir="auto">If the <strong>focus</strong> is on that <strong>list</strong>, the script <strong>correctly</strong> marked <strong>all</strong> the zones in <strong><code>red</code></strong> but <strong>no bookmarking</strong> occurs ! Oddly, it <strong>bookmarks</strong> the <strong>virtual</strong> final line of the list, instead !</p>
</li>
<li>
<p dir="auto">If the focus is on the file being <strong>analyzed</strong>, the script <strong>correctly</strong> bookmarks <strong>all</strong> the lines where the zones belong but, strangely, it <strong><code>red</code></strong>-marks, only, the <strong>first two</strong> matches as with your <strong><code>1st</code></strong> script !?</p>
</li>
</ul>
<p dir="auto">I’m sure you won’t be <strong>long</strong> to find out a <strong>solution</strong> to these problems !</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60616</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60616</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 09 Dec 2020 00:14:51 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Wed, 09 Dec 2020 09:20:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a></p>
<p dir="auto">Sorry it took me so long, but here’s the revised script (it is actually shorter, now!) with your desired changes, plus as a bonus it also bookmarks lines:</p>
<pre><code># -*- coding: utf-8 -*-

from Npp import editor, editor1, editor2, notepad

class T19249a(object):
    def __init__(self):
        SCE_UNIVERSAL_FOUND_STYLE = 31  # redmarking indicator number; name from N++ source code
        MARK_BOOKMARK = 24              # bookmarking marker number; name from N++ source code
        files_in_view_count_list = [ 0, 0 ]
        for (_, _, _, view) in notepad.getFiles(): files_in_view_count_list[view] += 1
        if files_in_view_count_list[0] == 0 or files_in_view_count_list[1] == 0:
            notepad.messageBox('This script requires 2 views to be open', '')
            return
        search_term_list = editor2.getText().splitlines()  # search terms are in secondary view
        for search_term in search_term_list:
            matches = []
            editor1.research(search_term, lambda m: matches.append(m.span(0)))
            editor1.setIndicatorCurrent(SCE_UNIVERSAL_FOUND_STYLE)
            for m in matches:
                editor1.indicatorFillRange(m[0], m[1] - m[0])
                editor1.markerAdd(editor1.lineFromPosition(m[0]), MARK_BOOKMARK)

if __name__ == '__main__': T19249a()
</code></pre>
<blockquote>
<p dir="auto">For instance we would be able to get whole words only</p>
</blockquote>
<p dir="auto">I think you can use the <code>\b</code> assertion in your regexes for this?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60608</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60608</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 09 Dec 2020 09:20:19 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Tue, 26 May 2020 20:55:42 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></p>
<p dir="auto">Haha, well, I was trying to keep it simple, according to the OP’s desire.<br />
But I will see what I can do.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54358</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54358</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 26 May 2020 20:55:42 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Tue, 26 May 2020 21:14:25 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <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">Once more, a <strong>nice</strong> script ! May I ask you for <strong>three</strong> improvements ?</p>
<ul>
<li>
<p dir="auto"><strong>Firstly</strong>, could it be possible to type the string <strong><code>Bob and Carol</code></strong>, which occurs <strong>twice</strong> in your text ? In other words, just simply consider <strong>all</strong> contents of <strong>each</strong> line !</p>
</li>
<li>
<p dir="auto"><strong>Secondly</strong>, would it be difficult to <strong>force</strong> your script to follow the <strong><code>Find</code></strong> dialog <strong>settings</strong> or take these settings in <strong>account</strong>, in some way ? For instance we would be able to get <strong>whole words</strong> only !</p>
</li>
<li>
<p dir="auto"><strong>Thirdly</strong>, it’s a <strong>regex</strong> man who speaks : could you consider <strong>regex</strong> expressions ? For instance :</p>
<ul>
<li>
<p dir="auto"><strong><code>^.{29}\K.{10}</code></strong>              #  Marks <strong>all</strong> a table contents from <strong>columns</strong> <strong><code>30</code></strong> to <strong><code>39</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>\bBob.{2,20}Carol\b</code></strong>   #  Marks the <strong>two</strong> first names <strong><code>Bob</code></strong> and <strong><code>Carol</code></strong>, <strong>no</strong> more than <strong><code>20</code></strong> characters <strong>apart</strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">In your text, it would match the <strong><code>3</code></strong> strings <strong>Bob and Carol</strong>, <strong>Bob’s surprise, Carol</strong> and <strong>Bob’s infidelity and Carol</strong></p>
<p dir="auto">As usual, <strong>Alan</strong>, do as you like to ;-))</p>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54357</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54357</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 26 May 2020 21:14:25 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Tue, 26 May 2020 13:41:16 GMT]]></title><description><![CDATA[<p dir="auto">So I came up with the following Pythonscript.<br />
Basic scripting instructions can be found <a href="https://community.notepad-plus-plus.org/post/54309">HERE</a>.<br />
The script will take a list of words in the active tab of one of the views, and apply marking to active tab in the other view document.<br />
The script attempts to autodetect which view is which.</p>
<p dir="auto">Example, after running:</p>
<p dir="auto"><img src="/assets/uploads/files/1590500405497-06ad2222-227f-4c4a-b9d8-8f8d6c134a71-image.png" alt="06ad2222-227f-4c4a-b9d8-8f8d6c134a71-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The script:</p>
<pre><code># -*- coding: utf-8 -*-

from Npp import editor, editor1, editor2, notepad

class T19249(object):
    def __init__(self):
        SCE_UNIVERSAL_FOUND_STYLE = 31  # redmarking indicator number; name from N++ source code
        files_in_view_count_list = [ 0, 0 ]
        for (_, _, _, view) in notepad.getFiles(): files_in_view_count_list[view] += 1
        if files_in_view_count_list[0] == 0 or files_in_view_count_list[1] == 0:
            notepad.messageBox('This script requires 2 views to be open', '')
            return
        editor_for_text_to_mark = editor1
        word_list = editor2.getText().splitlines()  # try secondary view first, looking for 1 word per line
        for word in word_list:
            if ' ' in word.strip():
                word_list = editor1.getText().splitlines()  # try primary view, looking for 1 word per line
                for word in word_list:
                    if ' ' in word.strip():
                        notepad.messageBox("Can't find one-word-per-line list in either view's active tab")
                        return
                editor_for_text_to_mark = editor2
                break
        for word in word_list:
            matches = []
            editor_for_text_to_mark.search(word, lambda m: matches.append(m.span(0)))
            editor_for_text_to_mark.setIndicatorCurrent(SCE_UNIVERSAL_FOUND_STYLE)
            for m in matches: editor_for_text_to_mark.indicatorFillRange(m[0], m[1] - m[0])

if __name__ == '__main__': T19249()
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/54316</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54316</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 26 May 2020 13:41:16 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Mon, 25 May 2020 10:49:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/baz-bazooo" aria-label="Profile: BAZ-BAZOOO">@<bdi>BAZ-BAZOOO</bdi></a> said in <a href="/post/54278">Bookmark multi words from multi lines in a text</a>:</p>
<blockquote>
<p dir="auto">am i clear now ?</p>
</blockquote>
<p dir="auto">Not really.  Maybe?</p>
<blockquote>
<p dir="auto">each line contains many words</p>
</blockquote>
<p dir="auto">I saw some lines with ONE “word” per line (as the definition of a “word” is alphanumerics plus underscore, and words are separated with spaces.  I saw no spaces in the lines.</p>
<blockquote>
<p dir="auto">I want away to highlight all line that contains _ABCDEFG</p>
</blockquote>
<p dir="auto">So this <code>_ABCDEFG</code> would be on a line by itself in a text file of other such words?</p>
<p dir="auto">I will see about scripting something up, where the list of words is in view2 and the file to apply marking to is in view1.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54281</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54281</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 25 May 2020 10:49:29 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Mon, 25 May 2020 01:56:23 GMT]]></title><description><![CDATA[<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></p>
<h2>I suppose the bottom line is that you have to state your problem in a much better and much clearer way before anyone can really help. We tried.</h2>
<p dir="auto">Okay here is my clear way to explain what i need</p>
<p dir="auto">very simple</p>
<p dir="auto">for example if i have 100 line and each line contains many words such as</p>
<p dir="auto">ihgfR678ihGFDFyuiI_ABCDEFGZZZZZZZZ<br />
jhgfTYUijhgFHGHJkjhgfYUI_ABCDEFGZZZZZZZZZZ<br />
jhgfRTYuhgfDRTYUI_AAAA<br />
JfgyudftyHvc_rrrrrRRRRR</p>
<p dir="auto">I want away to highlight all line that contains _ABCDEFG which is the first and the second ,</p>
<p dir="auto">a plugin where i can feed the app with a list of lines that i am looking to highlight into a text file using notepad</p>
<p dir="auto">am i clear now ?</p>
<p dir="auto">thank you so much for your time ,</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54278</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54278</guid><dc:creator><![CDATA[BAZ BAZOOO]]></dc:creator><pubDate>Mon, 25 May 2020 01:56:23 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Tue, 28 Apr 2020 12:58:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/baz-bazooo" aria-label="Profile: BAZ-BAZOOO">@<bdi>BAZ-BAZOOO</bdi></a></p>
<p dir="auto">More advice for you <a href="https://community.notepad-plus-plus.org/post/53194">HERE</a> about your call for “someone to make you a plugin”</p>
]]></description><link>https://community.notepad-plus-plus.org/post/53195</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/53195</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 28 Apr 2020 12:58:07 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Tue, 28 Apr 2020 12:39:38 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">i tried this and didnt work…its complicated</p>
</blockquote>
<p dir="auto">“didn’t work” gives us no further insight into your problem…</p>
<blockquote>
<p dir="auto">if i have to repeat this vertical bar on each txt file it will take all day</p>
</blockquote>
<p dir="auto">Well, there is a <em>Replace in Files</em> function, but I really hesitate to give more advice because the overall need is so vague.</p>
<blockquote>
<p dir="auto">maybe someone can make a plugin</p>
</blockquote>
<p dir="auto">Nobody but possibly you is going to make such a plugin.</p>
<p dir="auto">I suppose the bottom line is that you have to state your problem in a much better and much clearer way before anyone can really help.  We tried.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/53192</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/53192</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 28 Apr 2020 12:39:38 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Tue, 28 Apr 2020 02:49:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> said in <a href="/post/52940">Bookmark multi words from multi lines in a text</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/baz-bazooo" aria-label="Profile: BAZ-BAZOOO">@<bdi>BAZ-BAZOOO</bdi></a><br />
I haven’t used it but the <a href="https://sourceforge.net/projects/analyseplugin/" rel="nofollow ugc">Analyse Plugin</a> may be useful here based on description:</p>
<p dir="auto">“With this plugin you can search for multiple patterns in any of the opened documents in NotePad++.”</p>
<p dir="auto">Cheers.</p>
</blockquote>
<p dir="auto">This work perfect only if i put a words then click add</p>
<p dir="auto">but here comes another question</p>
<p dir="auto">how can i add multi words a word per line ?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/53166</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/53166</guid><dc:creator><![CDATA[BAZ BAZOOO]]></dc:creator><pubDate>Tue, 28 Apr 2020 02:49:26 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Tue, 28 Apr 2020 02:25:56 GMT]]></title><description><![CDATA[<p dir="auto">I wish something easier i tried this and didnt work i believe it works for you its complicated , i wish there is anything will be done quickly if i have to repeat this vertical bar on each txt file it will take all day , maybe someone can make a plugin ? to search for words in each line and mark that line if words be found ?</p>
<p dir="auto">Thanks in advance.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/53165</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/53165</guid><dc:creator><![CDATA[BAZ BAZOOO]]></dc:creator><pubDate>Tue, 28 Apr 2020 02:25:56 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Wed, 22 Apr 2020 12:56:20 GMT]]></title><description><![CDATA[<p dir="auto">Maybe a script is “overkill”.  Let’s try a different technique.</p>
<p dir="auto">Take the file that contains your “word” list (assume one word per line with nothing else on the line; also presumes only alphanumeric characters – like you show – in the list) and select the list.</p>
<p dir="auto">Open the <em><strong>Replace</strong></em> dialog by pressing <strong>Ctrl+h</strong> and then set up the following search parameters:<br />
<em><strong>Find what</strong></em> box: <code>\R</code><br />
<em><strong>Replace with</strong></em> box: <code>|</code><br />
<em><strong>Search mode</strong></em> radiobutton: <em><strong>Regular expression</strong></em><br />
<em><strong>In selection</strong></em> checkbox: <strong>ticked</strong><br />
Untick any other checkboxes.<br />
Then press the <em><strong>Replace All</strong></em> button.</p>
<p dir="auto">This will put your word list all on one line; verify that the rightmost character on that line isn’t a <code>|</code>; remove it if it is.</p>
<p dir="auto">Select this new long line of data and check the status bar of Notepad++ to see how long it is.  If it is longer than roughly 2040 characters, we’ve got problems, but let’s assume it is less than that.</p>
<p dir="auto">Now press <em>Ctrl+f</em>.  The <em>Find</em> window should open and your long line placed in the <em>Find what</em> box.</p>
<p dir="auto">Switch to the <em>Mark</em> tab and set up the following:</p>
<p dir="auto"><em><strong>Find what</strong></em> box: &lt;—retains your data<br />
<em><strong>Bookmark line</strong></em> checkbox: <strong>ticked</strong><br />
<em><strong>Wrap around</strong></em> checkbox: <strong>ticked</strong><br />
<em><strong>Search mode</strong></em> radiobutton: <em><strong>Regular expression</strong></em><br />
Untick any other checkboxes.</p>
<p dir="auto">Activate the file that you want to put the bookmarks into.  This could be the same file as your word list data but it could be a different file as well.</p>
<p dir="auto">Then press the <em>Mark All</em> button in the <em>Mark</em> window.</p>
<p dir="auto">You should achieve books on any and all lines containing a word from the word list.</p>
<p dir="auto">Let’s try it:</p>
<p dir="auto">Create some data we want to put bookmarks in, in a temporary file in Notepad++:</p>
<pre><code class="language-z">After a weekend of emotional honesty at an
Esalen-style retreat, Los Angeles
sophisticates Bob and Carol Sanders (Robert
Culp and Natalie Wood) return home determined
to embrace complete openness. They share their
enthusiasm and excitement over their new-found
philosophy with their more conservative
friends Ted and Alice Henderson (Elliott Gould
and Dyan Cannon), who remain doubtful. Soon
after, filmmaker Bob has an affair with a
young production assistant on a film shoot in
San Francisco. When he gets home he admits his
liaison to Carol, describing the event as a
purely physical act, not an emotional one. To
Bob's surprise, Carol is completely accepting
of his extramarital behavior. Later, Carol
gleefully reveals the affair to Ted and Alice
as they are leaving a dinner party. Disturbed
by Bob's infidelity and Carol's candor, Alice
becomes physically ill on the drive home. She
and Ted have a difficult time coping with the
news in bed that night. But as time passes
they grow to accept that Bob and Carol really
are fine with the affair. Later, Ted admits to
Bob that he was tempted to have an affair
once, but didn't go through with it; Bob tells
Ted he should, rationalizing: "You've got the
guilt anyway. Don't waste it."
</code></pre>
<p dir="auto">Make a short word list in a different temporary file in Notepad++:</p>
<pre><code class="language-z">Bob
Carol
Alice
</code></pre>
<p dir="auto">Select and run the replacement to achieve:</p>
<pre><code class="language-z">Bob|Carol|Alice|
</code></pre>
<p dir="auto">Remove rightmost <code>|</code> character to get:</p>
<pre><code class="language-z">Bob|Carol|Alice
</code></pre>
<p dir="auto">Select that one line, not status bar says length is 15, which is fine:  <code>Sel : 15 | 1</code></p>
<p dir="auto">Press Ctrl+f to get the data into the <em>Find what</em> box of the <em>Find</em> window.</p>
<p dir="auto">Move to the <em>Mark</em> tab and follow the setup instructions above.</p>
<p dir="auto">Activate the file tab in Notepad++ that contains the data that needs bookmarking.</p>
<p dir="auto">Press the <em>Mark All</em> button in the <em>Mark</em> window to achieve:</p>
<p dir="auto"><img src="/assets/uploads/files/1587559870239-37f083cf-f2cc-44d6-84df-ceb89f9fcb40-image.png" alt="37f083cf-f2cc-44d6-84df-ceb89f9fcb40-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">If the word list, when combined into one line, happens to be longer than a couple of thousand characters, you just have to break it down into several lists and apply the technique described above repeatedly.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52958</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52958</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 22 Apr 2020 12:56:20 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Tue, 21 Apr 2020 22:26:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/baz-bazooo" aria-label="Profile: BAZ-BAZOOO">@<bdi>BAZ-BAZOOO</bdi></a></p>
<p dir="auto">So you have a list of 200 or so partial words, and you want to bookmark any lines in a Notepad++ window that contain any of these partials?</p>
<p dir="auto">I guess a script could do that easily enough.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52941</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52941</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 Apr 2020 22:26:39 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmark multi words from multi lines in a text on Tue, 21 Apr 2020 22:15:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/baz-bazooo" aria-label="Profile: BAZ-BAZOOO">@<bdi>BAZ-BAZOOO</bdi></a><br />
I haven’t used it but the <a href="https://sourceforge.net/projects/analyseplugin/" rel="nofollow ugc">Analyse Plugin</a> may be useful here based on description:</p>
<p dir="auto">“With this plugin you can search for multiple patterns in any of the opened documents in NotePad++.”</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52940</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52940</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Tue, 21 Apr 2020 22:15:42 GMT</pubDate></item></channel></rss>