<div dir="ltr">Found this: <a href="http://stackoverflow.com/questions/13871833/negative-lookahead-assertion-not-working-in-python">http://stackoverflow.com/questions/13871833/negative-lookahead-assertion-not-working-in-python</a>.<div>
<br></div><div>This pattern seems to work:</div><div><div>pattern = re.compile(r"^(?!.*(CTL|DEL|RUN))")</div></div><div><br></div><div>But I am not sure why.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Jul 1, 2013 at 5:07 PM, Jason Friedman <span dir="ltr"><<a href="mailto:jsf80238@gmail.com" target="_blank">jsf80238@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I have table names in this form:<div>MY_TABLE</div><div>MY_TABLE_CTL</div><div>MY_TABLE_DEL</div><div>MY_TABLE_RUN</div><div>YOUR_TABLE<br></div><div>YOUR_TABLE_CTL<br></div><div>YOUR_TABLE_DEL<br></div><div>
YOUR_TABLE_RUN<br></div><div><br></div><div>I am trying to create a regular expression that will return true for only these tables:</div><div><div>MY_TABLE</div><div>YOUR_TABLE<br></div></div><div><br></div><div>I tried these:</div>
<div><div>pattern = re.compile(r"_(?!(CTL|DEL|RUN))")</div></div><div><div><div>pattern = re.compile(r"\w+(?!(CTL|DEL|RUN))")<br></div></div></div><div><div>pattern = re.compile(r"(?!(CTL|DEL|RUN)$)")<br>
</div></div><div><br></div><div>But, both match.</div><div>I do not need to capture anything.</div></div>
</blockquote></div><br></div>