<?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[Bookmarking multi-line regex is not working as expected]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">I’m trying to filter a Postgresql log file for INSERT, UPDATE and DELETE statements, following this excellent tip <a href="https://superuser.com/questions/290247/delete-all-lines-in-notepad-except-lines-containing-a-word-i-need" rel="nofollow ugc">here</a>.</p>
<p dir="auto">My problem is that some of those statements have indented lines below them (see sample lines below) that i need to also match and bookmark so that those multi-line statements do not get cut off. I achieve the marking part with the following regex (the “. finds \r and \n” option is turned off):</p>
<p dir="auto">^2019.<em>?(?:"INSERT"|"UPDATE"|"DELETE").</em>?(:?((\R  +|\t+).<em>?)</em>)$</p>
<p dir="auto">The multi-line blocks do get selected correctly, but only the non-indented (“first”) lines of those blocks get bookmarked, even though the whole blocks are marked red by notepad++. Using the “Find” tab and searching forward, I made sure that all blocks do in fact get selected as a whole, but when I switch to “2 find buttons” and move backwards, the selection doesn’t move from block to block but goes through each “sub-line” separately. This behavior made me wonder if maybe the groups where the problem, that’s why I made them non-capturing, but that didn’t help.</p>
<p dir="auto">Any tips on how I would have to improve my regex would be greatly appreciated!</p>
<p dir="auto">Kind regards,</p>
<p dir="auto">Christian</p>
<p dir="auto">SAMPLE (except for the last line, every line/block gets matched):</p>
<p dir="auto">2019-05-15 16:09:28.125 UTC,“moodle”,“sb_moodle”,27233,“::1:43344”,5cdc39b8.6a61,36,“SELECT”,2019-05-15 16:09:28 UTC,3/1165,0,LOG,00000,“execute &lt;unnamed&gt;: SELECT ‘x’ FROM mdl_quiz_attempts WHERE userid = $1 AND quiz = $2 LIMIT 1”,“parameters: $1 = ‘2’, $2 = ‘1’”,“”<br />
2019-05-15 16:09:28.427 UTC,“moodle”,“sb_moodle”,27233,“::1:43344”,5cdc39b8.6a61,31,“DELETE”,2019-05-15 16:09:28 UTC,3/1160,0,LOG,00000,“execute &lt;unnamed&gt;: DELETE FROM mdl_question_attempt_step_data WHERE attemptstepid IN (<br />
SELECT <a href="http://qas.id" rel="nofollow ugc">qas.id</a><br />
FROM mdl_question_attempts qa<br />
JOIN mdl_question_attempt_steps qas ON qas.questionattemptid = <a href="http://qa.id" rel="nofollow ugc">qa.id</a><br />
WHERE qa.questionusageid = $1)”,“parameters: $1 = ‘191’”,“”<br />
2019-05-15 16:09:28.429 UTC,“moodle”,“sb_moodle”,27233,“::1:43344”,5cdc39b8.6a61,32,“DELETE”,2019-05-15 16:09:28 UTC,3/1161,0,LOG,00000,“execute &lt;unnamed&gt;: DELETE FROM mdl_question_attempt_steps WHERE questionattemptid IN (<br />
SELECT <a href="http://qa.id" rel="nofollow ugc">qa.id</a><br />
FROM mdl_question_attempts qa<br />
WHERE qa.questionusageid = $1)”,“parameters: $1 = ‘191’”,“”<br />
2019-05-15 16:09:28.431 UTC,“moodle”,“sb_moodle”,27233,“::1:43344”,5cdc39b8.6a61,33,“DELETE”,2019-05-15 16:09:28 UTC,3/1162,0,LOG,00000,“execute &lt;unnamed&gt;: DELETE FROM mdl_question_attempts WHERE mdl_question_attempts.questionusageid = $1”,“parameters: $1 = ‘191’”,“”<br />
2019-05-15 16:09:28.432 UTC,“moodle”,“sb_moodle”,27233,“::1:43344”,5cdc39b8.6a61,34,“DELETE”,2019-05-15 16:09:28 UTC,3/1163,0,LOG,00000,“execute &lt;unnamed&gt;: DELETE FROM mdl_question_usages WHERE mdl_question_usages.id = $1”,“parameters: $1 = ‘191’”,“”<br />
2019-05-15 16:09:28.433 UTC,“moodle”,“sb_moodle”,27233,“::1:43344”,5cdc39b8.6a61,35,“DELETE”,2019-05-15 16:09:28 UTC,3/1164,0,LOG,00000,“execute &lt;unnamed&gt;: DELETE FROM mdl_quiz_attempts WHERE id = $1”,“parameters: $1 = ‘32’”,“”<br />
2019-05-15 16:09:28.435 UTC,“moodle”,“sb_moodle”,27233,“::1:43344”,5cdc39b8.6a61,36,“SELECT”,2019-05-15 16:09:28 UTC,3/1165,0,LOG,00000,“execute &lt;unnamed&gt;: SELECT ‘x’ FROM mdl_quiz_attempts WHERE userid = $1 AND quiz = $2 LIMIT 1”,“parameters: $1 = ‘2’, $2 = ‘2’”,“”</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/17633/bookmarking-multi-line-regex-is-not-working-as-expected</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Jul 2026 19:16:10 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/17633.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 15 May 2019 20:04:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bookmarking multi-line regex is not working as expected on Wed, 15 May 2019 23:26:50 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-schmitt" aria-label="Profile: christian-schmitt">@<bdi>christian-schmitt</bdi></a>,</p>
<p dir="auto">Just try this <strong>regex</strong>, below. It should bookmark <strong>all</strong> the lines that you want to !</p>
<p dir="auto"><strong><code>(?-is)^2019.*"(INSERT|UPDATE|DELETE)".*|^\h+.+</code></strong></p>
<p dir="auto">How this regex works :</p>
<ul>
<li>
<p dir="auto">First, the <strong>in-line</strong> modifiers <strong><code>(?-is)</code></strong> assure that :</p>
<ul>
<li>
<p dir="auto">The regex engine will consider any <strong>dot</strong> as a <strong>single standard</strong> character, only ( <strong><code>-s</code></strong> part )</p>
</li>
<li>
<p dir="auto">The search is performed in an <strong>non-insensitive</strong> to case way ( <strong><code>-i</code></strong> part )</p>
</li>
</ul>
</li>
<li>
<p dir="auto">Then, the regex is composed of <strong>two</strong> alternatives, delimited with the <strong><code>|</code></strong> <strong>alternation</strong> symbol</p>
<ul>
<li>
<p dir="auto">The part <strong><code>^2019.*"(INSERT|UPDATE|DELETE)".*</code></strong>, <strong>similar</strong> to your version, search for <strong>2019</strong>, at <strong>beginning</strong> of line, followed wiht any range, even <strong>null</strong>, of <strong>standard</strong> characters, till <strong>one</strong> of the <strong><code>3</code></strong> words <strong>INSERT</strong>, <strong>UPDATE</strong> or <strong>DELETE</strong>, surrounded by <strong>double-quotes</strong>, and then, followed with the <strong>remainder</strong> of current line</p>
</li>
<li>
<p dir="auto">The part <strong><code>^\h+.+</code></strong> searches for any line <strong>beginning</strong> with either some <strong>space</strong> or <strong>tabulation</strong> character(s) ( so <strong>horizontal blank</strong> chars ) and the <strong>non-null remainder</strong> of these lines</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">Note that if you just want to <strong>bookmark</strong> the lines, ignoring the <strong>red highlighting</strong>, you just need the <strong>shortened</strong> version, below :</p>
<p dir="auto"><strong><code>(?-is)^2019.*"(INSERT|UPDATE|DELETE)"|^\h+</code></strong></p>
<p dir="auto">Disable the <strong><code>View &gt; Word wrap</code></strong> option for a <strong>better</strong> lisibility ;-))</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43407</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43407</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 15 May 2019 23:26:50 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmarking multi-line regex is not working as expected on Wed, 15 May 2019 20:34:45 GMT]]></title><description><![CDATA[<p dir="auto">Hi Alan,</p>
<p dir="auto">thanks for the quick reply and pointing me to the thread, I’ll try it out!</p>
<p dir="auto">Just for completeness (in case someone is interested in the regex), <a href="https://pastebin.com/WqLUhTJQ" rel="nofollow ugc">here’s the correct syntax and sample lines on Pastebin</a>.</p>
<p dir="auto">Best regards,</p>
<p dir="auto">Christian</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43390</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43390</guid><dc:creator><![CDATA[Christian Schmitt]]></dc:creator><pubDate>Wed, 15 May 2019 20:34:45 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmarking multi-line regex is not working as expected on Wed, 15 May 2019 20:19:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-schmitt" aria-label="Profile: Christian-Schmitt">@<bdi>Christian-Schmitt</bdi></a></p>
<p dir="auto">There’s a Pythonscript in <a href="https://notepad-plus-plus.org/community/topic/12192/remove-unmarked-lines-not-just-unbookmarked-lines" rel="nofollow ugc">this thread</a> --don’t be put off by that thread’s title–that provides a workaround if you’d consider using that plugin to help solve your problem.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43388</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43388</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 15 May 2019 20:19:53 GMT</pubDate></item><item><title><![CDATA[Reply to Bookmarking multi-line regex is not working as expected on Wed, 15 May 2019 20:16:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-schmitt" aria-label="Profile: Christian-Schmitt">@<bdi>Christian-Schmitt</bdi></a></p>
<blockquote>
<p dir="auto">The multi-line blocks do get selected correctly, but only the non-indented (“first”) lines of those blocks get bookmarked</p>
</blockquote>
<p dir="auto">This has come up before.  Unfortunately, what you’ve described is how it is known to work.  :(</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43387</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43387</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 15 May 2019 20:16:45 GMT</pubDate></item></channel></rss>