<?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[RegEx - Finding strings when another substring not present]]></title><description><![CDATA[<p dir="auto">I am trying to parse an IIS log in Notepad++ so that it returns the From address when the log line does not contain OutboundConnectionCommand.</p>
<pre><code>2023-03-07 01:30:24 1.2.3.4 OutboundConnectionCommand SMTPSVC1 SERVER01- 0 MAIL - FROM:&lt;any_name@abc.com&gt;+SIZE=933660 0 0 4 0 141 SMTP - - - -

2023-03-07 01:30:24 1.2.3.4Server02.abc.com SMTPSVC1 SERVER01 1.2.3.4 0 MAIL - +FROM:&lt;any_name@abc.com&gt; 250 0 60 47 0 SMTP - - - -
</code></pre>
<p dir="auto">I want to return</p>
<pre><code>From:&lt;any_name@abc.com&gt;
</code></pre>
<p dir="auto">if OutboundConnectionCommand does not exist in the line.  I assume I would have to use a negative lookbehind, but I cannot quite get the command correct.</p>
<p dir="auto">Tried this in <a href="http://regex101.com" rel="nofollow ugc">regex101.com</a> but it looks like it matches both From: strings:</p>
<pre><code>FROM:.*&gt;(?&lt;!\bOutboundConnectionCommand\b)
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/topic/24240/regex-finding-strings-when-another-substring-not-present</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 08:32:25 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/24240.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 10 Mar 2023 16:25:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Wed, 21 Jun 2023 19:33:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a>  just adding that the version that I was using did not have the option in Mark to Copy Marked Text.  I was one version behind.  Upgrading Notepad++ gave me that option.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/87302</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/87302</guid><dc:creator><![CDATA[Zeff Wheelock 0]]></dc:creator><pubDate>Wed, 21 Jun 2023 19:33:52 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Tue, 21 Mar 2023 22:01:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26710">@Mark-Olson</a> said in <a href="/post/85059">RegEx - Finding strings when another substring not present</a>:</p>
<blockquote>
<p dir="auto">The \K operator for forgetting all the text found so far is really cool and I’m glad I learned about it.</p>
</blockquote>
<p dir="auto">Not strictly necessary for the above, though.<br />
If this wasn’t an “evolved” solution I probably wouldn’t have used it.<br />
But it was a matter of “where are we now”…ok…CANCEL with <code>\K</code>!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85060</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85060</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 Mar 2023 22:01:37 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Tue, 21 Mar 2023 21:26:19 GMT]]></title><description><![CDATA[<p dir="auto">The <code>\K</code> operator for forgetting all the text found so far is <em>really cool</em> and I’m glad I learned about it.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85059</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85059</guid><dc:creator><![CDATA[Mark Olson]]></dc:creator><pubDate>Tue, 21 Mar 2023 21:26:19 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Tue, 21 Mar 2023 19:13:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/27836">@Zeff-Wheelock-0</a> said in <a href="/post/85054">RegEx - Finding strings when another substring not present</a>:</p>
<blockquote>
<p dir="auto">I had the previous version of Notepad++.  Upgraded to the new version</p>
</blockquote>
<p dir="auto">I don’t think an upgrade had anything to do with it, but it is good that you have some satisfaction!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85055</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85055</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 Mar 2023 19:13:47 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Tue, 21 Mar 2023 19:06:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a><br />
Thanks!  I had the previous version of Notepad++.  Upgraded to the new version and your solution worked flawlessly and fast!  Thanks for the help!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85054</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85054</guid><dc:creator><![CDATA[Zeff Wheelock 0]]></dc:creator><pubDate>Tue, 21 Mar 2023 19:06:14 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Tue, 21 Mar 2023 13:14:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/27836">@Zeff-Wheelock-0</a> said in <a href="/post/85045">RegEx - Finding strings when another substring not present</a>:</p>
<blockquote>
<p dir="auto">that just blanked out the whole line</p>
</blockquote>
<p dir="auto">Hmm, my testing shows that it replaces the line with ONLY the email address.</p>
<blockquote>
<p dir="auto">get the email address</p>
</blockquote>
<p dir="auto">But we don’t know what this means.<br />
Maybe your goal isn’t replacement in the original file…</p>
<p dir="auto">If you literally mean you just want a copy of the email addresses that match the criteria you’ve previously outlined, I’d suggest a <em>Mark</em> operation followed by a <em>Copy Marked Text</em> operation followed by a paste (somewhere else).</p>
<p dir="auto"><img src="/assets/uploads/files/1679401281718-c65cc211-7bf4-49f0-8e3f-e66c8dbc85b7-image.png" alt="c65cc211-7bf4-49f0-8e3f-e66c8dbc85b7-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Find: <code>(?-is)^.*?OutboundConnectionCommand.*?FROM:&lt;\K.+?(?=&gt;)</code></p>
<p dir="auto">Press <em>Mark All</em>.<br />
Press <em>Copy Marked Text</em>.<br />
Move to new tab; paste:</p>
<p dir="auto"><img src="/assets/uploads/files/1679401370534-5753d674-bf64-416c-af22-df29e6e6847e-image.png" alt="5753d674-bf64-416c-af22-df29e6e6847e-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/85046</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85046</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 Mar 2023 13:14:01 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Tue, 21 Mar 2023 12:14:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a><br />
Unfortunately, that just blanked out the whole line.  I am trying to match any line that contains the bolded content and get the email address within the Less Than/Greater Than delimiters:</p>
<p dir="auto">2023-03-07 01:30:24 1.2.3.4 <strong>OutboundConnectionCommand</strong> SMTPSVC1 SERVER01- 0 MAIL - <strong>FROM</strong>:&lt;return_email_address_between_delimiters@abc.xyz&gt;+SIZE=933660 0 0 4 0 141 SMTP - - - -</p>
<p dir="auto">Thanks for helping me out!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85045</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85045</guid><dc:creator><![CDATA[Zeff Wheelock 0]]></dc:creator><pubDate>Tue, 21 Mar 2023 12:14:50 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Mon, 20 Mar 2023 17:59:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/27836">@Zeff-Wheelock-0</a></p>
<p dir="auto">I’ve sort of lost track of what the full need is, but I think you can match the entire line with the email address into capture group 1 with:</p>
<p dir="auto">Find: <code>(?-is)^.*?OutboundConnectionCommand.*?FROM:&lt;(.+?)&gt;.*</code></p>
<p dir="auto">Then you might replace with <code>${1}</code> ?</p>
<p dir="auto">Again, a lot of info, so I can’t really pick off what is needed.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85032</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85032</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 20 Mar 2023 17:59:58 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Mon, 20 Mar 2023 17:52:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a><br />
I apologize for that.  After seeing your answer, I realized that I probably needed to add more context than the original ask.</p>
<p dir="auto">I have tried:</p>
<pre><code>(?=.*\bOutboundConnectionCommand\b)(?=.*FROM)(?&lt;=\&lt;).*(?=\&gt;)
</code></pre>
<p dir="auto">But it seems to select the entire line.  Am I close?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85031</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85031</guid><dc:creator><![CDATA[Zeff Wheelock 0]]></dc:creator><pubDate>Mon, 20 Mar 2023 17:52:42 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Mon, 20 Mar 2023 16:25:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/27836">@Zeff-Wheelock-0</a> said in <a href="/post/85026">RegEx - Finding strings when another substring not present</a>:</p>
<blockquote>
<p dir="auto">extract the email addresses on all lines that had OutboundConnectionCommand</p>
</blockquote>
<p dir="auto">This is different in a big way from your original request.<br />
Evolving needs tends to confuse those offering help…<br />
But it appears you are well on your way to solving your own problem, so that’s great!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85029</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85029</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 20 Mar 2023 16:25:20 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Mon, 20 Mar 2023 16:18:04 GMT]]></title><description><![CDATA[<p dir="auto">I have figured out how to find the line I want using:</p>
<pre><code>(?=.*\bOutboundConnectionCommand\b)(?=.*FROM)
</code></pre>
<p dir="auto">Now I just need to extract the email between the &lt; and &gt;</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85028</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85028</guid><dc:creator><![CDATA[Zeff Wheelock 0]]></dc:creator><pubDate>Mon, 20 Mar 2023 16:18:04 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Mon, 20 Mar 2023 15:15:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a><br />
Thanks for the RegEx.  We are getting closer to what I would like.  I tried your solution and it successfully selects the entire line.  I apologize that I did not include the entire situation.  The IIS log tells of all the emails that come into it and get sent out.  So, for each email, there will be an incoming and an outgoing entry.  Before, I was just extracting the email addresses, but I realized that I was double counting the email addresses (incoming and outgoing).  So, I figured I would try and extract the email addresses on all lines that had OutboundConnectionCommand (the emails that are leaving IIS) and try and extract the email address between the FROM:&lt; and the ending &gt;.  Can NotePad++, using RegEx (I assume), find the line as you noted in your reply, extract the email address between FROM:&lt; and &gt; ?</p>
<p dir="auto">I would assume that the replace line would be something along the lines of \r\n&lt;regex of email address&gt;\r\n so then I can apply the bookmarking of that line that would then facilitate me removing all unmarked bookmarks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85026</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85026</guid><dc:creator><![CDATA[Zeff Wheelock 0]]></dc:creator><pubDate>Mon, 20 Mar 2023 15:15:40 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx - Finding strings when another substring not present on Fri, 10 Mar 2023 18:11:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/27836">@Zeff-Wheelock-0</a></p>
<p dir="auto">Probably this matches what you want?:</p>
<p dir="auto">Find: <code>(?-is)^(?!.*OutboundConnectionCommand).*?FROM:&lt;any_name@abc\.com&gt;</code><br />
Search mode: Regular expression</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84772</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84772</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 10 Mar 2023 18:11:29 GMT</pubDate></item></channel></rss>