<?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[Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase]]></title><description><![CDATA[<p dir="auto">When I run this Pythonscript code:</p>
<pre><code>'''
print         01
Print         02
PrinT         03
prinT         04
 print        05
 Print        06
 Print        07
 prinT        08
'''

matches = []

editor.research(r'(?i)\&lt;print\&gt;\s*\d+', lambda m: matches.append(m.span()))

for (s,e) in matches: print editor.getTextRange(s, e)
</code></pre>
<p dir="auto">It only matches the “print” lines with these numbers:  01, 04, 05, 08.  The unmatched lines all contain uppercase “P” in the print.</p>
<p dir="auto">However, if I do an interactive Notepad++ search using the same regular expression, it matches all eight print lines.  It also matches all eight lines if I try it in RegexBuddy.</p>
<p dir="auto">Any ideas on why this is different?  I always thought that Pythonscript’s re.search() used the same engine as Notepad++'s interactive Find, but these results seem to indicate something different.</p>
<p dir="auto">It seems to be related to the <strong>\&lt;</strong> and <strong>\&gt;</strong> word boundary specifiers.  If I switch to <strong>\b</strong> then it works as expected.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/13249/pythonscript-search-different-than-n-search-when-using-and-leading-uppercase</link><generator>RSS for Node</generator><lastBuildDate>Wed, 20 May 2026 06:46:03 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/13249.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Feb 2017 14:33:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Sun, 12 Feb 2017 22:47:32 GMT]]></title><description><![CDATA[<p dir="auto">Hi <strong>Alan</strong> and <strong>MapJe71</strong>,</p>
<p dir="auto">Thanks, <strong>MapJe71</strong>, for the link about <strong>Word Boundaries</strong>, from the <strong>definitive</strong> site about <strong>regular</strong> expressions ! Of course, <strong>Alan</strong>, I know the differences between the <strong>three</strong> assertions : <strong><code>\b</code></strong> , <strong><code>\&lt;</code></strong> and <strong><code>\&gt;</code></strong>. I just preferred not to speak about it, <strong>first</strong>, in order to keep concentrated on your problem !</p>
<p dir="auto">To be short, the <strong><code>\b</code></strong> <strong>assertion</strong> acts, either, as a <strong><code>\&lt;</code></strong> <strong>assertion</strong> OR as a <strong><code>\&gt;</code></strong> <strong>assertion</strong>. This explains that the regex <strong><code>\&lt;WORD\&gt;</code></strong> can be simply replaced by the regex <strong><code>\bWORD\b</code></strong>.</p>
<p dir="auto">BTW, in the <strong>Words Boundaries</strong> table, I noticed the <strong>POSIX</strong> word boundaries  ( <strong><code>[[:&lt;:]]</code></strong> and <strong><code>[[:&gt;:]]</code></strong> ) which have, exactly, the <strong>same</strong> meaning as the <strong>GNU</strong> word boundaries <strong><code>\&lt;</code></strong>  and <strong><code>&gt;\</code></strong> ). These syntaxes are <strong>functional</strong>, with the N++ Boost regex engine ! Unfortunately, <strong>Alan</strong>, the problem that you noticed does occur with the <strong>POSIX</strong> word boundaries, too :-((.</p>
<hr />
<p dir="auto">On top of that, from the <strong>LAST</strong> row of the “Word Boundaries” table, named <strong>Word Boundaries behaviour</strong>, it is said that “word boundaries” are not <strong>correctly</strong> handled, in most <strong>regex</strong> engines :</p>
<blockquote>
<p dir="auto">Word boundaries always match at the start of the match attempt if that position is followed by a word character, regardless of the character that precedes the start of the match attempt. (Thus, word boundaries are not handled correctly for the second and following match attempts in the same string.)</p>
</blockquote>
<p dir="auto">And it shows an example :</p>
<blockquote>
<p dir="auto">\b. matches all of the letters but not the space when iterating over all matches, in the string “abc def”</p>
</blockquote>
<hr />
<p dir="auto">So, I did some tests ( again !! )</p>
<ul>
<li>I copied this <strong>single</strong> sentence, below, part of the <strong>license.txt</strong> file, in a <strong>new</strong> tab</li>
</ul>
<pre><code class="language-css">By contrast, the GNU General Public License is intended to guarantee your freedom...
</code></pre>
<ul>
<li>
<p dir="auto">In the <strong>Find</strong> dialog, I left the <strong>Match case</strong> and the <strong>. matches newline</strong> options <strong>UNCHECKED</strong></p>
</li>
<li>
<p dir="auto">I selected, of course, the <strong>Regular expression</strong> search mode</p>
</li>
<li>
<p dir="auto">I <strong>tested</strong> the different regexes, below, against the <strong>example</strong> text</p>
</li>
</ul>
<p dir="auto"><strong>REMARK</strong> : In the table, below, each <strong>dash</strong> character, under the sentence, indicates a <strong>match</strong> of the corresponding regex(es) !</p>
<pre><code class="language-css">========================================================================================================================
|     REGEXES     |                EXAMPLE text    -     MATCHES noted by a DASH character               |   RESULTS   |
========================================================================================================================
|                 |                                                                                      |             |
|                 | By contrast, the GNU General Public License is intended to guarantee your freedom... | INCORRECT ! |
|  (^|(?&lt;!\w)).   | ------------------------------------------------------------------------------------ |             |
|                 |                                                                                      |             |
+-----------------+--------------------------------------------------------------------------------------+-------------+
|                 |                                                                                      |             |
|  \b.            |                                                                                      |             |
|  \&lt;.            |                                                                                      |             |
|  [[:&lt;:]].       |                                                                                      |             |
|                 |                                                                                      |             |
|                 | By contrast, the GNU General Public License is intended to guarantee your freedom... | INCORRECT ! |
|  \b\w           | -- --------  --- --- ------- ------ ------- -- -------- -- --------- ---- -------    |             |
|  \&lt;\w           |                                                                                      |             |
|  [[:&lt;:]]\w      |                                                                                      |             |
|  (^|(?&lt;!\w))\w  |                                                                                      |             |
|                 |                                                                                      |             |
+-----------------+--------------------------------------------------------------------------------------+-------------+
|                 |                                                                                      |             |
|                 | By contrast, the GNU General Public License is intended to guarantee your freedom... |  INCORRECT  |
|  (^|(?&lt;=\W)).   | -  -        -    -   -       -      -       -  -        -  -         -    -       -  |             |
|                 |                                                                                      |             |
+-----------------+--------------------------------------------------------------------------------------+-------------+
|                 |                                                                                      | (At last !) |
|                 | By contrast, the GNU General Public License is intended to guarantee your freedom... |             |
|  (^|(?&lt;=\W))\w  | -  -         -   -   -       -      -       -  -        -  -         -    -          |   CORRECT   |
|                 |                                                                                      |             |
==================+======================================================================================+==============
|                 |                                                                                      |             |
|                 | By contrast, the GNU General Public License is intended to guarantee your freedom... | INCORRECT ! |
|  .\b            |  --       - -  --  --      --     --      -- --       -- --        --   --      -    |             |
|                 |                                                                                      |             |
+-----------------+--------------------------------------------------------------------------------------+-------------+
|                 |                                                                                      |             |
|                 |                                                                                      |             |
|  .((?=\W)|$)    | By contrast, the GNU General Public License is intended to guarantee your freedom... | INCORRECT ! |
|  .((?!\w)|$)    |  -        --   -   -       -      -       -  -        -  -         -    -       ---- |             |
|                 |                                                                                      |             |
|                 |                                                                                      |             |
+-----------------+--------------------------------------------------------------------------------------+-------------+
|                 |                                                                                      |             |
|  .\&gt;            |                                                                                      |             |
|  .[[:&gt;:]]       |                                                                                      |             |
|                 |                                                                                      |             |
|  \w\b           | By contrast, the GNU General Public License is intended to guarantee your freedom... |   CORRECT   |
|  \w\&gt;           |  -        -    -   -       -      -       -  -        -  -         -    -       -    |             |
|  \w[[:&gt;:]]      |                                                                                      |             |
|  \w((?=\W)|$)   |                                                                                      |             |
|  \w((?!\w)|$)   |                                                                                      |             |
|                 |                                                                                      |             |
========================================================================================================================
</code></pre>
<hr />
<p dir="auto">From that table, it obvious that the handle of the <strong>assertions</strong>, by the <strong>N++ Boost</strong> engine, seems <strong>quite weird</strong> !!!</p>
<p dir="auto">To be <strong>coherent</strong>, only <strong>two</strong> regexes, with <strong>similar</strong> syntax, should be used :</p>
<ul>
<li>
<p dir="auto">The regex <strong><code>(^|(?&lt;=\W))\w</code></strong>, which matches the <strong>FIRST</strong> character of a <strong>word</strong></p>
</li>
<li>
<p dir="auto">The regex <strong><code>\w((?=\W)|$)</code></strong>, which matches the <strong>LAST</strong> character of a <strong>word</strong></p>
</li>
</ul>
<p dir="auto">=&gt; The regex <strong><code>(^|(?&lt;=\W))\w|\w((?=\W)|$)</code></strong> matches the <strong>first</strong> AND the <strong>last</strong> characters of a <strong>word</strong></p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21807</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21807</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 12 Feb 2017 22:47:32 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Sun, 12 Feb 2017 13:36:41 GMT]]></title><description><![CDATA[<p dir="auto">See reference on <a href="http://www.regular-expressions.info/refwordboundaries.html" rel="nofollow ugc">Word Boundaries</a> for</p>
<ul>
<li>description on differences between <code>\b</code>, <code>\&lt;</code>  and <code>\&gt;</code>;</li>
<li>which “engine” supports what.</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/21805</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21805</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Sun, 12 Feb 2017 13:36:41 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Sun, 12 Feb 2017 13:20:26 GMT]]></title><description><![CDATA[<p dir="auto">First of all, it is great to see such rousing discussion about the issue I discovered!  :-)  Thanks to all for that.</p>
<p dir="auto">There are lots of things to think about coming out of this discussion, but the most obvious and immediate one is a question for Mr Guy:  You keep suggesting to use \b instead of \&lt; , but they are not always equivalent, correct?  They may be equivalent for certain examples, but in the most general case I believe they are different.  If they weren’t different, there would be no reason for both to exist in the N++/Boost engine…</p>
<p dir="auto">I mean, even I discussed using \b instead in my very first posting in this thread, but that was just as a test, not necessarily a blanket substitution.  I guess I don’t want others reading this thread to takeaway that \b and \&lt; are the exact same thing.</p>
<p dir="auto">Comments?  Thoughts?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21803</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21803</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 12 Feb 2017 13:20:26 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Sun, 12 Feb 2017 09:09:05 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <strong>Claudia</strong> and <strong>All</strong>,</p>
<p dir="auto">Hum…,finally, <strong>Claudia</strong>, I think that you’re right :-) Indeed, if we built the <strong>general</strong> table, below, which recapitulates the <strong>main</strong> cases, it’s obvious that :</p>
<ul>
<li>
<p dir="auto">Results are <strong>OK</strong>, when the “Match case” flag, is <strong>ONLY</strong> used, <strong>WITHOUT</strong> any in-line modifier ( Lines <strong>1</strong> and <strong>4</strong> )</p>
</li>
<li>
<p dir="auto">Results seem <strong>OK</strong>, ( UP TO NOW ), when the “Match case” flag is <strong>used</strong>, with a starting <strong><code>(?-i)</code></strong> in-line modifier ( Lines <strong>3</strong> et <strong>6</strong> )</p>
</li>
<li>
<p dir="auto">Results seem <strong>OK</strong>, ( UP TO NOW ), when the “Match case” flag is <strong>OFF</strong>, with a starting <strong><code>(?i)</code></strong> in-line modifier ( Line <strong>2</strong> )</p>
</li>
<li>
<p dir="auto">Results are <strong><code>NOT</code></strong> <strong>OK</strong>, when the “Match case” flag is <strong>ON</strong>, with a starting <strong><code>(?i)</code></strong> in-line modifier and a regex which <strong>begins</strong> with the <strong><code>\&lt;</code></strong> assertion ( Line <strong>5</strong> )</p>
</li>
</ul>
<p dir="auto">Luckily, this LAST case ( Line <strong>5</strong> ) is rather <strong>rare</strong> and does <strong>not</strong> occur if we use the <strong><code>\b</code></strong> syntax, instead of <strong><code>\&lt;</code></strong> :-))</p>
<pre><code class="language-css">+=======+=======================+====================+===========+==================+
|  Row  |   "Match case" flag   |  In-line modifier  |  Results  |     Remarks      |
+=======+=======================+====================+===========+==================+
|   1   |          OFF          |         NO         |  Correct  |  Implicit (?i)   |
+-------+-----------------------+--------------------+-----------+------------------+
|   2   |          OFF          |        (?i)        |  Correct  |                  |
+-------+-----------------------+--------------------+-----------+------------------+
|   3   |          OFF          |        (?-i)       |  Correct  |                  |
+=======+=======================+====================+===========+==================+
|   4   |          ON           |         NO         |  Correct  |  Implicit (?-i)  |
+-------+-----------------------+--------------------+-----------+------------------+
|   5   |          ON           |        (?i)        |  PROBLEM  |  IF use of \&lt;    |
+-------+-----------------------+--------------------+-----------+------------------+
|   6   |          ON           |        (?-i)       |  Correct  |                  |
+=======+=======================+====================+===========+==================+
</code></pre>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21800</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21800</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 12 Feb 2017 09:09:05 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Sat, 11 Feb 2017 22:21:17 GMT]]></title><description><![CDATA[<p dir="auto">Hi Guy,</p>
<p dir="auto">thx for your effort on this but I have to disagree with your disagree ;-D</p>
<p dir="auto">From regex execution point of view there are two ways to change<br />
the case behavior. Either by providing a flag or using the in-line modifiers.<br />
When providing the flag everything is ok (at least for the moment) - so<br />
I have to assume that the regex engine works correctly in this case.<br />
When providing the in-line modifier and the flags then it isn’t ok always.<br />
This does mean there is a bug and it must be related to how in-line modifiers<br />
are handled against flags. And that makes me think that the bug is when doing<br />
this overwrite - which means we can’t rely on it. Maybe other in-line modifiers<br />
together with some special regex constructs behave wrong as well.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21780</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21780</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Sat, 11 Feb 2017 22:21:17 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Sat, 11 Feb 2017 19:30:35 GMT]]></title><description><![CDATA[<p dir="auto">I need to <strong>split</strong> this post in <strong>two</strong> parts because it exceeds <strong>16384</strong> characters !</p>
<pre><code class="language-css">+-------+------------------------------------------------------------------------------------+
|       |       Option "Match case"  OFF       and       Regex, below, PRECEDED by (?i)      |
| Text  |-----+-------+-------+-------+-------+---------+---------+--------------------------|
|       | xYZ | xYZ\&gt; | xYZ\b | \&lt;xYZ | \bxYZ | \&lt;xYZ\&gt; | \bxYZ\b | (^|(?&lt;=\W))xYZ((?=\W)|$) |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| xYz   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| xyZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| xYZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| Xyz   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| XYz   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| XyZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| XYZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1xYz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1xyZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1xYZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1Xyz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1XYz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1XyZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1XYZ  |  *  |   *   |   *   |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz9  |  *  |       |       |   *   |   *   |         |         |                          |
| xYz9  |  *  |       |       |   *   |   *   |         |         |                          |
| xyZ9  |  *  |       |       |   *   |   *   |         |         |                          |
| xYZ9  |  *  |       |       |   *   |   *   |         |         |                          |
| Xyz9  |  *  |       |       |   *   |   *   |         |         |                          |
| XYz9  |  *  |       |       |   *   |   *   |         |         |                          |
| XyZ9  |  *  |       |       |   *   |   *   |         |         |                          |
| XYZ9  |  *  |       |       |   *   |   *   |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz9 |  *  |       |       |       |       |         |         |                          |
| 1xYz9 |  *  |       |       |       |       |         |         |                          |
| 1xyZ9 |  *  |       |       |       |       |         |         |                          |
| 1xYZ9 |  *  |       |       |       |       |         |         |                          |
| 1Xyz9 |  *  |       |       |       |       |         |         |                          |
| 1XYz9 |  *  |       |       |       |       |         |         |                          |
| 1XyZ9 |  *  |       |       |       |       |         |         |                          |
| 1XYZ9 |  *  |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+


+-------+------------------------------------------------------------------------------------+
|       |       Option "Match case"  ON       and       Regex, below, PRECEDED by (?-i)      |
| Text  |-----+-------+-------+-------+-------+---------+---------+--------------------------|
|       | xYZ | xYZ\&gt; | xYZ\b | \&lt;xYZ | \bxYZ | \&lt;xYZ\&gt; | \bxYZ\b | (^|(?&lt;=\W))xYZ((?=\W)|$) |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz   |     |       |       |       |       |         |         |                          |
| xYz   |     |       |       |       |       |         |         |                          |
| xyZ   |     |       |       |       |       |         |         |                          |
| xYZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| Xyz   |     |       |       |       |       |         |         |                          |
| XYz   |     |       |       |       |       |         |         |                          |
| XyZ   |     |       |       |       |       |         |         |                          |
| XYZ   |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz  |     |       |       |       |       |         |         |                          |
| 1xYz  |     |       |       |       |       |         |         |                          |
| 1xyZ  |     |       |       |       |       |         |         |                          |
| 1xYZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1Xyz  |     |       |       |       |       |         |         |                          |
| 1XYz  |     |       |       |       |       |         |         |                          |
| 1XyZ  |     |       |       |       |       |         |         |                          |
| 1XYZ  |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz9  |     |       |       |       |       |         |         |                          |
| xYz9  |     |       |       |       |       |         |         |                          |
| xyZ9  |     |       |       |       |       |         |         |                          |
| xYZ9  |  *  |       |       |   *   |   *   |         |         |                          |
| Xyz9  |     |       |       |       |       |         |         |                          |
| XYz9  |     |       |       |       |       |         |         |                          |
| XyZ9  |     |       |       |       |       |         |         |                          |
| XYZ9  |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz9 |     |       |       |       |       |         |         |                          |
| 1xYz9 |     |       |       |       |       |         |         |                          |
| 1xyZ9 |     |       |       |       |       |         |         |                          |
| 1xYZ9 |  *  |       |       |       |       |         |         |                          |
| 1Xyz9 |     |       |       |       |       |         |         |                          |
| 1XYz9 |     |       |       |       |       |         |         |                          |
| 1XyZ9 |     |       |       |       |       |         |         |                          |
| 1XYZ9 |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+


+-------+------------------------------------------------------------------------------------+
|       |       Option "Match case"  OFF       and       Regex, below, PRECEDED by (?-i)     |
| Text  |-----+-------+-------+-------+-------+---------+---------+--------------------------|
|       | xYZ | xYZ\&gt; | xYZ\b | \&lt;xYZ | \bxYZ | \&lt;xYZ\&gt; | \bxYZ\b | (^|(?&lt;=\W))xYZ((?=\W)|$) |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz   |     |       |       |       |       |         |         |                          |
| xYz   |     |       |       |       |       |         |         |                          |
| xyZ   |     |       |       |       |       |         |         |                          |
| xYZ   |  *  |   *   |   *   |   *   |       |    *    |    *    |            *             |
| Xyz   |     |       |       |       |       |         |         |                          |
| XYz   |     |       |       |       |       |         |         |                          |
| XyZ   |     |       |       |       |       |         |         |                          |
| XYZ   |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz  |     |       |       |       |       |         |         |                          |
| 1xYz  |     |       |       |       |       |         |         |                          |
| 1xyZ  |     |       |       |       |       |         |         |                          |
| 1xYZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1Xyz  |     |       |       |       |       |         |         |                          |
| 1XYz  |     |       |       |       |       |         |         |                          |
| 1XyZ  |     |       |       |       |       |         |         |                          |
| 1XYZ  |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz9  |     |       |       |       |       |         |         |                          |
| xYz9  |     |       |       |       |       |         |         |                          |
| xyZ9  |     |       |       |       |       |         |         |                          |
| xYZ9  |  *  |       |       |   *   |       |         |         |                          |
| Xyz9  |     |       |       |       |       |         |         |                          |
| XYz9  |     |       |       |       |       |         |         |                          |
| XyZ9  |     |       |       |       |       |         |         |                          |
| XYZ9  |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz9 |     |       |       |       |       |         |         |                          |
| 1xYz9 |     |       |       |       |       |         |         |                          |
| 1xyZ9 |     |       |       |       |       |         |         |                          |
| 1xYZ9 |  *  |       |       |       |       |         |         |                          |
| 1Xyz9 |     |       |       |       |       |         |         |                          |
| 1XYz9 |     |       |       |       |       |         |         |                          |
| 1XyZ9 |     |       |       |       |       |         |         |                          |
| 1XYZ9 |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
</code></pre>
<hr />
<p dir="auto">From these results, we can <strong>deduce</strong> than the N++ Boost regex engine <strong>lacks</strong> to match <strong>4</strong> ( or <strong>8</strong> ) cases, <strong>ONLY IF</strong> the <strong>four</strong> conditions, below, occur, <strong>simultaneously</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong>Match case</strong> option, of the <strong>Find</strong> dialog, is <strong>ON</strong></p>
</li>
<li>
<p dir="auto">A <strong><code>(?i)</code></strong> modifier <strong>starts</strong> the regex</p>
</li>
<li>
<p dir="auto">The regex <strong>begins</strong> with the <strong><code>\&lt;</code></strong> assertion</p>
</li>
<li>
<p dir="auto">The text, to match, begins with an <strong>UPPER</strong> letter</p>
</li>
</ul>
<hr />
<p dir="auto">Luckily :</p>
<ul>
<li>
<p dir="auto">The regex <strong><code>\&lt;xYZ</code></strong> can be changed by the regex <strong><code>\bxYZ</code></strong></p>
</li>
<li>
<p dir="auto">The regex <strong><code>\&lt;xYZ\&gt;</code></strong> can be changed by the regex <strong><code>\bxYZ\b</code></strong></p>
</li>
</ul>
<p dir="auto">And note that :</p>
<ul>
<li>
<p dir="auto">The assertion <strong><code>\&lt;</code></strong> may be <strong>replaced</strong> by the assertion <strong><code>(^|(?&lt;=\W))</code></strong></p>
</li>
<li>
<p dir="auto">The assertion <strong><code>\&gt;</code></strong> may be <strong>replaced</strong> by the assertion <strong><code>((?=\W)|$)</code></strong></p>
</li>
</ul>
<p dir="auto">Cheers</p>
<p dir="auto">guy038</p>
<p dir="auto">BTW, <strong>Claudia</strong>, when you said :</p>
<blockquote>
<p dir="auto">I agree, I assumed too, that using the modifiers overrules the flags but with the regex<br />
you used we see it isn’t.</p>
</blockquote>
<p dir="auto">I <strong>disagree</strong> ! Indeed :</p>
<p dir="auto">Considering the text below :</p>
<pre><code class="language-css">xyz
xYz
xyZ
xYZ
Xyz
XYz
XyZ
XYZ
</code></pre>
<p dir="auto">Of course, the <strong>two</strong> regexes <strong><code>(?i)\&lt;xYZ</code></strong> and <strong><code>(?i)\&lt;xYZ\&gt;</code></strong>, with the <strong>Match case</strong> option <strong>ON</strong>, match the <strong>first four</strong> cases, only</p>
<p dir="auto">But, the <strong>two</strong> regexes <strong><code>(?i)\&lt;XYZ</code></strong> and <strong><code>(?i)\&lt;XYZ\&gt;</code></strong>, with the <strong>Match case</strong> option <strong>ON</strong>, ALSO match the <strong>first four</strong> cases, only !</p>
<p dir="auto">So, I do think that the <strong>in-line modifiers</strong> <strong><code>(?i)</code></strong> and <strong><code>(?-i)</code></strong> have <strong>ALWAYS priority</strong> over the <strong>Match case</strong> option</p>
<p dir="auto">And, like you, I rather think that it’s just a <strong>bug</strong> [ in the implementation ] of the <strong>Boost regex</strong> engine !</p>
<p dir="auto">Besides, the <strong>two</strong> regexes <strong><code>(?i)\bxYZ</code></strong> and <strong><code>(?i)\bxYZ\b</code></strong>, with the <strong>Match case</strong> option <strong>ON</strong>, <strong>correctly</strong> match the <strong>eight</strong> cases, above, of the string “<strong>xyz</strong>” :-)) =&gt; The <strong><code>(?i)</code></strong> modifier forces the <strong>insensitive</strong> search !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21778</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21778</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 11 Feb 2017 19:30:35 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Sat, 11 Feb 2017 19:27:44 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <strong>All</strong>,</p>
<p dir="auto">I did some <strong>tests</strong>, using the classical <strong>Find</strong> dialog, with the <strong>original</strong> text, below :</p>
<pre><code>xyz
xYz
xyZ
xYZ
Xyz
XYz
XyZ
XYZ
-----
1xyz
1xYz
1xyZ
1xYZ
1Xyz
1XYz
1XyZ
1XYZ
-----
xyz9
xYz9
xyZ9
xYZ9
Xyz9
XYz9
XyZ9
XYZ9
-----
1xyz9
1xYz9
1xyZ9
1xYZ9
1Xyz9
1XYz9
1XyZ9
1XYZ9
</code></pre>
<p dir="auto">Then I tested the <strong>different</strong> regexes</p>
<ul>
<li>
<p dir="auto"><strong><code>xYZ</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>xYZ\&gt;</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>xYZ\b</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>\&lt;xYZ</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>\bxYZ</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>\&lt;xYZ\&gt;</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>\bxYZ\b</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>(^|(?&lt;=\W))xYZ((?=\W)|$)</code></strong></p>
</li>
<li>
<p dir="auto">With the <strong>Match case</strong> option <strong>ON</strong></p>
</li>
<li>
<p dir="auto">With the <strong>Match case</strong> option <strong>OFF</strong></p>
</li>
<li>
<p dir="auto">Preceded by <strong><code>(?i)</code></strong> and with the <strong>Match case</strong> option <strong>ON</strong></p>
</li>
<li>
<p dir="auto">Preceded by <strong><code>(?i)</code></strong> and with the <strong>Match case</strong> option <strong>OFF</strong></p>
</li>
<li>
<p dir="auto">Preceded by <strong><code>(?-i)</code></strong> and with the <strong>Match case</strong> option <strong>ON</strong></p>
</li>
<li>
<p dir="auto">Preceded by <strong><code>(?-i)</code></strong> and with the <strong>Match case</strong> option <strong>OFF</strong></p>
</li>
</ul>
<p dir="auto">I obtained the <strong>six following</strong> tables, where :</p>
<ul>
<li>
<p dir="auto">A <strong>correct</strong> match is indicated by a <strong><code>*</code></strong> character</p>
</li>
<li>
<p dir="auto">An <strong>incorrect</strong> match is indicated by the <strong><code>E</code></strong> letter ( <strong>Error</strong> )</p>
</li>
</ul>
<hr />
<pre><code class="language-css">+-------+------------------------------------------------------------------------------------+
|       |            Option "Match case"  ON           and           Regex, below            |
| Text  |-----+-------+-------+-------+-------+---------+---------+--------------------------|
|       | xYZ | xYZ\&gt; | xYZ\b | \&lt;xYZ | \bxYZ | \&lt;xYZ\&gt; | \bxYZ\b | (^|(?&lt;=\W))xYZ((?=\W)|$) |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz   |     |       |       |       |       |         |         |                          |
| xYz   |     |       |       |       |       |         |         |                          |
| xyZ   |     |       |       |       |       |         |         |                          |
| xYZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| Xyz   |     |       |       |       |       |         |         |                          |
| XYz   |     |       |       |       |       |         |         |                          |
| XyZ   |     |       |       |       |       |         |         |                          |
| XYZ   |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz  |     |       |       |       |       |         |         |                          |
| 1xYz  |     |       |       |       |       |         |         |                          |
| 1xyZ  |     |       |       |       |       |         |         |                          |
| 1xYZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1Xyz  |     |       |       |       |       |         |         |                          |
| 1XYz  |     |       |       |       |       |         |         |                          |
| 1XyZ  |     |       |       |       |       |         |         |                          |
| 1XYZ  |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz9  |     |       |       |       |       |         |         |                          |
| xYz9  |     |       |       |       |       |         |         |                          |
| xyZ9  |     |       |       |       |       |         |         |                          |
| xYZ9  |  *  |       |       |   *   |   *   |         |         |                          |
| Xyz9  |     |       |       |       |       |         |         |                          |
| XYz9  |     |       |       |       |       |         |         |                          |
| XyZ9  |     |       |       |       |       |         |         |                          |
| XYZ9  |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz9 |     |       |       |       |       |         |         |                          |
| 1xYz9 |     |       |       |       |       |         |         |                          |
| 1xyZ9 |     |       |       |       |       |         |         |                          |
| 1xYZ9 |  *  |       |       |       |       |         |         |                          |
| 1Xyz9 |     |       |       |       |       |         |         |                          |
| 1XYz9 |     |       |       |       |       |         |         |                          |
| 1XyZ9 |     |       |       |       |       |         |         |                          |
| 1XYZ9 |     |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+


+-------+------------------------------------------------------------------------------------+
|       |            Option "Match case"  OFF          and           Regex, below            |
| Text  |-----+-------+-------+-------+-------+---------+---------+--------------------------|
|       | xYZ | xYZ\&gt; | xYZ\b | \&lt;xYZ | \bxYZ | \&lt;xYZ\&gt; | \bxYZ\b | (^|(?&lt;=\W))xYZ((?=\W)|$) |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| xYz   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| xyZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| xYZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| Xyz   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| XYz   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| XyZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| XYZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1xYz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1xyZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1xYZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1Xyz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1XYz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1XyZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1XYZ  |  *  |   *   |   *   |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz9  |  *  |       |       |   *   |   *   |         |         |                          |
| xYz9  |  *  |       |       |   *   |   *   |         |         |                          |
| xyZ9  |  *  |       |       |   *   |   *   |         |         |                          |
| xYZ9  |  *  |       |       |   *   |   *   |         |         |                          |
| Xyz9  |  *  |       |       |   *   |   *   |         |         |                          |
| XYz9  |  *  |       |       |   *   |   *   |         |         |                          |
| XyZ9  |  *  |       |       |   *   |   *   |         |         |                          |
| XYZ9  |  *  |       |       |   *   |   *   |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz9 |  *  |       |       |       |       |         |         |                          |
| 1xYz9 |  *  |       |       |       |       |         |         |                          |
| 1xyZ9 |  *  |       |       |       |       |         |         |                          |
| 1xYZ9 |  *  |       |       |       |       |         |         |                          |
| 1Xyz9 |  *  |       |       |       |       |         |         |                          |
| 1XYz9 |  *  |       |       |       |       |         |         |                          |
| 1XyZ9 |  *  |       |       |       |       |         |         |                          |
| 1XYZ9 |  *  |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+


+-------+------------------------------------------------------------------------------------+
|       |       Option "Match case"  ON       and       Regex, below, PRECEDED by (?i)       |
| Text  |-----+-------+-------+-------+-------+---------+---------+--------------------------|
|       | xYZ | xYZ\&gt; | xYZ\b | \&lt;xYZ | \bxYZ | \&lt;xYZ\&gt; | \bxYZ\b | (^|(?&lt;=\W))xYZ((?=\W)|$) |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| xYz   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| xyZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| xYZ   |  *  |   *   |   *   |   *   |   *   |    *    |    *    |            *             |
| Xyz   |  *  |   *   |   *   |   E   |   *   |    E    |    *    |            *             |
| XYz   |  *  |   *   |   *   |   E   |   *   |    E    |    *    |            *             |
| XyZ   |  *  |   *   |   *   |   E   |   *   |    E    |    *    |            *             |
| XYZ   |  *  |   *   |   *   |   E   |   *   |    E    |    *    |            *             |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1xYz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1xyZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1xYZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1Xyz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1XYz  |  *  |   *   |   *   |       |       |         |         |                          |
| 1XyZ  |  *  |   *   |   *   |       |       |         |         |                          |
| 1XYZ  |  *  |   *   |   *   |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| xyz9  |  *  |       |       |   *   |   *   |         |         |                          |
| xYz9  |  *  |       |       |   *   |   *   |         |         |                          |
| xyZ9  |  *  |       |       |   *   |   *   |         |         |                          |
| xYZ9  |  *  |       |       |   *   |   *   |         |         |                          |
| Xyz9  |  *  |       |       |   E   |   *   |         |         |                          |
| XYz9  |  *  |       |       |   E   |   *   |         |         |                          |
| XyZ9  |  *  |       |       |   E   |   *   |         |         |                          |
| XYZ9  |  *  |       |       |   E   |   *   |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+
| 1xyz9 |  *  |       |       |       |       |         |         |                          |
| 1xYz9 |  *  |       |       |       |       |         |         |                          |
| 1xyZ9 |  *  |       |       |       |       |         |         |                          |
| 1xYZ9 |  *  |       |       |       |       |         |         |                          |
| 1Xyz9 |  *  |       |       |       |       |         |         |                          |
| 1XYz9 |  *  |       |       |       |       |         |         |                          |
| 1XyZ9 |  *  |       |       |       |       |         |         |                          |
| 1XYZ9 |  *  |       |       |       |       |         |         |                          |
+-------+-----+-------+-------+-------+-------+---------+---------+--------------------------+


</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/21777</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21777</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 11 Feb 2017 19:27:44 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Fri, 10 Feb 2017 00:41:43 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">UUhhh - I should avoid magic numbers - 2=re.I</p>
</blockquote>
<p dir="auto">Damn right!!! LOL</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21737</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21737</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Fri, 10 Feb 2017 00:41:43 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Thu, 09 Feb 2017 22:49:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mapje71" aria-label="Profile: MAPJe71">@<bdi>MAPJe71</bdi></a></p>
<p dir="auto">Yep - same issue.</p>
<p dir="auto">New doc with the word Print only</p>
<pre><code>editor.rereplace('(?i)\&lt;print\&gt;', 'PRINT')
</code></pre>
<p dir="auto">fails where</p>
<pre><code>editor.rereplace('\&lt;print\&gt;', 'PRINT', 2)
</code></pre>
<p dir="auto">works</p>
<p dir="auto">UUhhh - I should avoid magic numbers - 2=re.I</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21732</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21732</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Thu, 09 Feb 2017 22:49:39 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Thu, 09 Feb 2017 22:39:27 GMT]]></title><description><![CDATA[<p dir="auto">Wondering if it’s only an issue with <code>editor.research( ... )</code>, as I have been using modifiers with <code>editor.rereplace( ... )</code> successfully.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21731</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21731</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Thu, 09 Feb 2017 22:39:27 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Thu, 09 Feb 2017 22:30:55 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>
<blockquote>
<p dir="auto">Well…what matters in regards to my script is that the regex search works correctly.</p>
</blockquote>
<p dir="auto">More philosophic, what means correct if we talk about regex.<br />
As long as the same regex can be interpreted differently by different regex engines<br />
how can we be sure what is right or wrong.</p>
<p dir="auto">I agree, I assumed too, that using the modifiers overrules the flags but with the regex<br />
you used we see it isn’t. I don’t know if this is a bug in the implementation of the boost<br />
regex engine or a bug of the boost regex engine. I don’t think that I will go in that detail.</p>
<p dir="auto">Concerning the correctness of the scripts - you found one misbehavior, I’m quite certain that others exist.</p>
<blockquote>
<p dir="auto">The bottom line is that the scripted search has a problem, and that problem is seemingly related to the use of &lt; and &gt; in the regex</p>
</blockquote>
<p dir="auto">Just to be clear, both, npp and pythonscript behave the same. It is not only python script which does this.</p>
<blockquote>
<p dir="auto">which I would like to be able to use. So, okay, we can “fix” that by working around it by playing with the flags stuff, and that is all fine, I guess.</p>
</blockquote>
<p dir="auto">From the test it looks like only the “start of word” and “end of word” word boundaries behave strange.<br />
If you stop using this particular item you might have already solved it.<br />
Until you discover the next issue.</p>
<blockquote>
<p dir="auto">But should that become a general rule for using Pythonscript’s re.search() function, based upon someone finding one weird case?<br />
Maybe there is no great answer to that at this point, but I’m attempting to create something general purpose,<br />
where I can’t test all possible regexes for how they work at coding time, as they are input at run-time.<br />
So I’m left wondering if the best thing to do when coding with editor.research() is to never embed (?i) or (?-i) in the regex,<br />
and instead always use the flags parameter. Perhaps based upon the data we have at this moment, that is the best course of action.</p>
</blockquote>
<p dir="auto">Personally, I’m avoiding now using the modifiers in scripts and using flags when needed.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21729</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21729</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Thu, 09 Feb 2017 22:30:55 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Thu, 09 Feb 2017 12:57:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a> said:</p>
<blockquote>
<p dir="auto">Does it matter in regards to your script?</p>
</blockquote>
<p dir="auto">Well…what matters in regards to my script is that the regex search works correctly.  The discussion about interactive versus scripted search and embedded flags versus separate flags is nice, but…</p>
<p dir="auto">The bottom line is that the scripted search has a problem, and that problem is seemingly related to the use of \&lt; and \&gt; in the regex, which I would like to be able to use.  So, okay, we can “fix” that by working around it by playing with the flags stuff, and that is all fine, I guess.</p>
<p dir="auto">But should that become a general rule for using Pythonscript’s re.search() function, based upon someone finding one weird case?  Maybe there is no great answer to that at this point, but I’m attempting to create something general purpose, where I can’t test all possible regexes for how they work at coding time, as they are input at run-time.</p>
<p dir="auto">So I’m left wondering if the best thing to do when coding with editor.research() is to never embed (?i) or (?-i) in the regex, and instead always use the flags parameter.  Perhaps based upon the data we have at this moment, that is the best course of action.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21703</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21703</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 09 Feb 2017 12:57:28 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 23:01:03 GMT]]></title><description><![CDATA[<p dir="auto">OK, from my point of view it looks like it is how I’ve described already.<br />
If npp find dialog and pythonscript research are using the same flags and regex,<br />
the result is the same.</p>
<p dir="auto">So, python script users needs to be aware that npp sets the ignorecase flag<br />
per default.</p>
<p dir="auto">If someone finds different behavior - please report.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21692</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21692</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Wed, 08 Feb 2017 23:01:03 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 21:35:28 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> ,<br />
at the moment, it looks like my last statement about the flags and if set the same seems to be correct.<br />
But this could mean I just haven’t found the regex which breaks it again or it is simply true.<br />
I like to tend to the latter :-)</p>
<p dir="auto">Does it matter in regards to your script?<br />
I assume, only if you want to compare with the interactive search dialog or<br />
when creating the regex with the dialog and afterwards using it in a script.</p>
<p dir="auto">If my statement about the flags is true, and you want to have the script behave exactly the same<br />
as npps find dialog does, then you need to provide the flags as npp does.</p>
<p dir="auto">I do see the advantage of using the modifiers but it looks like that neither pythonscript<br />
nor npp do it right in terms of the issue you found.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21689</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21689</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Wed, 08 Feb 2017 21:35:28 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 21:13:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a> , do you still have more testing to do, or have you taken it as far as it can go?  If you are done, then I have questions.  :)</p>
<p dir="auto">The main question is, should the golden rule be, when writing Pythonscript, to forget about embedding (?i) at the front of a regular expession string, and setting the flags parameter to re.IGNORECASE (or re.I, or even 2) to get the behavior that is desired?</p>
<p dir="auto">I always liked using (?i) because that way, when reading a regex from left to right, I could prepare myself properly, rather than having to look for a somewhat disconnected flags parameter.  But, if things aren’t going to work right, I can learn another way.</p>
<p dir="auto">However, I’m still confused about what I should do to make things work right in all cases…  :(</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21688</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21688</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 08 Feb 2017 21:13:22 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 19:15:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: Scott-Sumner">@<bdi>Scott-Sumner</bdi></a></p>
<p dir="auto">No, if you take into account that research is resulting the same but<br />
yes if you took that statement in general.<br />
I’m comparing npp dialog search and python script research results.</p>
<p dir="auto">But you are right, confusing!</p>
<p dir="auto">From testing it seems that research and npp search behave the same<br />
if flags are set the same.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21685</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21685</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Wed, 08 Feb 2017 19:15:58 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 18:39:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a> said:</p>
<blockquote>
<p dir="auto">If you do a search via the npp dialog using matchcase checkbox and (?i)<br />
you will see that it uses the matchcase instead of ignorecase.</p>
</blockquote>
<p dir="auto">Okay, so now I’m confused.  If I try a very simple interactive search (forget the \&lt; thing discussed earlier), where I lead off the Find-what box with (?i), it makes no difference whether the “match case” checkbox is checked or not, my simple search gets matches that ignore case.  <a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a> , doesn’t this result go against what you just said?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21684</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21684</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Wed, 08 Feb 2017 18:39:16 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 17:06:02 GMT]]></title><description><![CDATA[<p dir="auto">quick update<br />
I assume I found the difference and some glitch (depends on view).</p>
<p dir="auto">If searching by npp find/reaplce dialog the standard is ignorecase.<br />
Flag matchcase is only set if checkbox is checked (makes sense)</p>
<p dir="auto">If searching via pythonscript and research than standard is matchcase.<br />
Only if flag re.I is provided it does ignoring the case (again, makes sense)</p>
<p dir="auto">Our assumption was that regardless what has been selected, the usage of<br />
(?i) does mean that it will treat it as ignorecase and this is not the case.</p>
<p dir="auto">If you do a search via the npp dialog using matchcase checkbox and (?i)<br />
you will see that it uses the matchcase instead of ignorecase.</p>
<p dir="auto">So - at the moment I would say, both behave the same.</p>
<p dir="auto">I will do some further tests later.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21680</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21680</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Wed, 08 Feb 2017 17:06:02 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 15:56:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mapje71" aria-label="Profile: MAPJe71">@<bdi>MAPJe71</bdi></a></p>
<p dir="auto">yes, but research is not using python engine it is using boost engine, afaik.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21676</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21676</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Wed, 08 Feb 2017 15:56:05 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 15:57:05 GMT]]></title><description><![CDATA[<p dir="auto">Python 2.7.x does not interpret <code>\&lt;</code> and <code>\&gt;</code> as word boundaries.<br />
Verified it with RegexBuddy by changing the <code>Application (Regex Flavor)</code> from <code>boost::regex 1.58-1.59</code> to <code>python 2.7</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21675</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21675</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Wed, 08 Feb 2017 15:57:05 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 15:50:29 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">I’m in the same mood.</p>
<p dir="auto">I will try to see if I understand what npp is really doing under the hood.<br />
Maybe it is just replacing the (?i) with flags then the<br />
obvious solution would be to parse a regex for the flags and<br />
setting it explicitly, if using pythonscript, to get the same results.</p>
<p dir="auto">I will follow-up on this.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21673</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21673</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Wed, 08 Feb 2017 15:50:29 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 15:44:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a></p>
<p dir="auto">Thanks for your input, Claudia.  I’m not sure if your findings make me feel better about it, or worse!  :(</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21672</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21672</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 08 Feb 2017 15:44:41 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 15:38:10 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">Actually it looks like the issue is with the (?i) because if<br />
setting ignore case explicitly by using</p>
<pre><code>editor.research(b'(?i)\&lt;print\&gt;\s*\d+', lambda m: matches.append(m.span()),2)
</code></pre>
<p dir="auto">than you do get the same results.<br />
Note 2 = re.I</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21671</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21671</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Wed, 08 Feb 2017 15:38:10 GMT</pubDate></item><item><title><![CDATA[Reply to Pythonscript search different than N++ search when using &#x5C;&lt; and leading uppercase on Wed, 08 Feb 2017 15:13:17 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">it is using the same engine but, as you already said, it seems that there is a difference<br />
in the implementation, unfortunately.</p>
<p dir="auto">Can’t really say what - one needs to diff both implementations.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/21670</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/21670</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Wed, 08 Feb 2017 15:13:17 GMT</pubDate></item></channel></rss>