Regular expression negative look-ahead
jsf80238 at gmail.com
Tue Jul 2 04:27:51 CEST 2013
This pattern seems to work:
pattern = re.compile(r"^(?!.*(CTL|DEL|RUN))")
But I am not sure why.
On Mon, Jul 1, 2013 at 5:07 PM, Jason Friedman <jsf80238 at gmail.com> wrote:
> I have table names in this form:
> I am trying to create a regular expression that will return true for only
> these tables:
> I tried these:
> pattern = re.compile(r"_(?!(CTL|DEL|RUN))")
> pattern = re.compile(r"\w+(?!(CTL|DEL|RUN))")
> pattern = re.compile(r"(?!(CTL|DEL|RUN)$)")
> But, both match.
> I do not need to capture anything.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list