Regex Matching - A letter not preceded by another letter
<p>What could be regex which match <code>anystring</code> followed by <code>daily</code> but it must not match <code>daily</code> preceded by <code>m</code>?</p>

<p>For example it should match following string </p>

<ul>
<li><code>beta.daily</code></li>
<li><code>abcdaily</code></li>
<li><code>dailyabc</code></li>
<li><code>daily</code></li>
</ul>

<p>But it must not match</p>

<ul>
<li><code>mdaily</code> or</li>
<li><code>abcmdaily</code> or</li>
<li><code>mdailyabc</code></li>
</ul>

<p>I have tried following and other regex but failed each time:</p>

<ul>
<li><code>r'[^m]daily'</code>: But it doesn't match with <code>daily</code></li>
<li><code>r'[^m]?daily'</code> : It match with string containing <code>mdaily</code> which is not intended</li>
</ul>

<p>Just add a negative lookbehind, <code>(?&lt;!m)d</code>, before <code>daily</code>:</p>

<pre><code>(?&lt;!m)daily
</code></pre>

<p>The zero width negative lookbehind, <code>(?&lt;!m)</code>, makes sure <code>daily</code> is not preceded by <code>m</code>.</p>

<p><a href="https://regex101.com/r/wJ8mV5/1">Demo</a></p>

python regex