<?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[Need help tweaking a regex search expression]]></title><description><![CDATA[<p dir="auto">I’m new to regex, but found an expression…     (?-s)^.<em>ABC(?s).</em>?(?-s)XYZ.*\R   …that is supposed to select the first whole line that contains ‘ABC’ in it through the first whole line following that contains ‘XYZ’ in it. For example, given these five lines:</p>
<p dir="auto">&lt;li&gt;&lt;a href=“…/difdsfon.html”&gt;Build the disp</p>
<blockquote>
<p dir="auto">&lt;a href=“…/dilayABCroduction.html”&gt;After ro<br />
&lt;li&gt;&lt;a href=“…/displayPortfolio.html”&gt;Portfolio&lt;/a&gt;&lt;/li&gt;<br />
&lt;li class=“droXYZwn”&gt;<br />
&lt;a class="dropdown-to ass=“caret”&gt;&lt;/span&gt;&lt;/a&gt;</p>
</blockquote>
<p dir="auto">the expression would light up these three:</p>
<blockquote>
<p dir="auto">&lt;a href=“…/displayABCroduction.html”&gt;After ro<br />
&lt;li&gt;&lt;a href=“…/displayPortfolio.html”&gt;Portfolio&lt;/a&gt;&lt;/li&gt;<br />
&lt;li class=“droXYZwn”&gt;</p>
</blockquote>
<p dir="auto">But the expression doesn’t find anything. Not sure if it matters, but the text I’ll be searching will usually be html code with it’s own special characters - the garbage html above is representative. I’m using Notepad++ v6.8.6 on a Window 7 Pro machine.</p>
<p dir="auto">Help appreciated. My dog, who has been avoiding me since I started going insane on this quest yesterday morning, would also be grateful.</p>
<ul>
<li>Jim</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/topic/10938/need-help-tweaking-a-regex-search-expression</link><generator>RSS for Node</generator><lastBuildDate>Sat, 13 Jun 2026 21:25:12 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/10938.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 09 Dec 2015 17:50:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Need help tweaking a regex search expression on Fri, 18 Dec 2015 16:17:08 GMT]]></title><description><![CDATA[<p dir="auto">Thanks Scott, for the newline tip.</p>
<p dir="auto">Guy, I wanted to credit you for the search code in my original post but all I had here was the bare code in a .txt file, w/out any links to its origin, and it didn’t include the trailing |\z.</p>
<p dir="auto">Glad you got me straightened out, and I really appreciate the code bit explanations you took the trouble to provide in your reply to Shayne Z in October.</p>
<p dir="auto">Jim</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12663</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12663</guid><dc:creator><![CDATA[Jim Redfield]]></dc:creator><pubDate>Fri, 18 Dec 2015 16:17:08 GMT</pubDate></item><item><title><![CDATA[Reply to Need help tweaking a regex search expression on Thu, 10 Dec 2015 22:55:11 GMT]]></title><description><![CDATA[<p dir="auto">Hello <strong>Jim</strong>,</p>
<p dir="auto">I wrote this post, below, as a reply to <strong>Shayne Z.</strong>, on the beginning of <strong>October</strong> :</p>
<p dir="auto"><a href="https://notepad-plus-plus.org/community/topic/10607/anyone-can-help-with-this-regex/5" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/10607/anyone-can-help-with-this-regex/5</a></p>
<p dir="auto">As you spoke, in your post, of some <strong>particularities</strong>, about this reply, I just did some <strong>tests</strong>, again and I can’t see anything <strong>wrong</strong> !?</p>
<blockquote>
<p dir="auto">You have to un-check “. matches newline” for it to work.</p>
</blockquote>
<p dir="auto"><strong>Normally</strong>, you don’t have to <strong>bother</strong> about this option because I added, the <strong>modifiers</strong> <strong><code>(?s)</code></strong> and <strong><code>(?-s)</code></strong>, on purpose, as these internal settings have <strong>PRIORITY</strong> on a possible <strong>.matches newline</strong> option, set by an user.</p>
<blockquote>
<p dir="auto">If ‘Replace’ is left empty the line before ABC and the line after XYZ become one</p>
</blockquote>
<p dir="auto">I <strong>can’t</strong> reproduce this behaviour. For instance, given the text, below :</p>
<pre><code>12345
This line contains the ABC string
Bla, bla, bla...
This line contains the XYZ string
67890
</code></pre>
<p dir="auto">and the S/R below :</p>
<p dir="auto">SEARCH <strong><code>(?-s)^.*ABC(?s).*?(?-s)XYZ.*(\R|\z)</code></strong></p>
<p dir="auto">REPLACE <strong><code>NOTHING</code></strong></p>
<p dir="auto">I, as expected, got the text, <strong>after</strong> replacement :</p>
<pre><code>12345
67890
</code></pre>
<p dir="auto">But I may have forgotten something <strong>obvious</strong> ! So, just give me some <strong>examples</strong> which doesn’t behave as you would expect to. we’ll certainly find out the possible <strong>problems</strong> :-)</p>
<p dir="auto">Best regards</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12545</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12545</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 10 Dec 2015 22:55:11 GMT</pubDate></item><item><title><![CDATA[Reply to Need help tweaking a regex search expression on Thu, 10 Dec 2015 17:44:07 GMT]]></title><description><![CDATA[<p dir="auto">Rather on relying on copying an invisible character into the replace field, simply do \r\n for a Windows line-ending file, or \n for a Unix line-ending file.  Much easier to feel good that you’ve got what you intended in there.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12539</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12539</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Thu, 10 Dec 2015 17:44:07 GMT</pubDate></item><item><title><![CDATA[Reply to Need help tweaking a regex search expression on Thu, 10 Dec 2015 16:21:05 GMT]]></title><description><![CDATA[<p dir="auto">HERE’S THE ANSWER I FOUND FOR MY OWN QUESTION, ABOVE. The code below works in Notepad++ to select the first line found with ABC in it and the first line found after that with XYZ in it, and everything in between.  (?-s)^.<em>ABC(?s).</em>?(?-s)XYZ.*\R. You have to un-check “. matches newlin” for it to work.</p>
<p dir="auto">If ‘Replace’ is left empty the line before ABC and the line after XYZ become one. To keep them separate, do a Replace with a new line character. (Easy way to do that is simple copy the invisible new line character between adjacent lines of text in the doc you’re working with and paste it into the Replace field. You won’t see it there, but it is.) 'hope this is helpful for regexp newbies like me.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12538</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12538</guid><dc:creator><![CDATA[Jim Redfield]]></dc:creator><pubDate>Thu, 10 Dec 2015 16:21:05 GMT</pubDate></item></channel></rss>