Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #49617

Regular expression negative look-ahead

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jsf80238@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status UNSURE 0.275
X-Spam-Level **
X-Spam-Evidence '*H*': 0.51; '*S*': 0.06; 'subject:Regular': 0.16; 'subject:expression': 0.16; 'trying': 0.19; 'form:': 0.24; 'tried': 0.27; 'message-id:@mail.gmail.com': 0.30; 'regular': 0.32; 'to:name:python-list': 0.33; 'table': 0.34; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'expression': 0.60; 'skip:f 50': 0.65; 'anything.': 0.68; 'skip:r 40': 0.68; 'skip:r 30': 0.69; 'capture': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=OVSZ67shhfJi8VGgLT4hDzy63UiAtE+6xkK5Ttk9y8E=; b=NC71NqYhg16IvP5UNv7GMQlQ4j9mVorM7ONLtdTfEPq0KXnbEYjgWaA4+nU34GRKYo WmCglUisc1SYoiyvavGf55VvFtxl3MODPJP0uk3abpkL9dTMXXw3srdN3vWG9Jb9gv0t zeK/5ShFwz/i9hK+JgwyzKrkR7PTlDivPjR+IS8EgzRazVuK/Bp+CT/hjVp+zTvxiVmk t1XRolC/u5CU/B/yUb7LlMACT75+Hoo7BfoUc5BpUyefX3bCdJkYJVHAwFjppwhSSQkL nlna/2DPFQi286YWIfT6buVN9qvT5ahIA/TsveksHvmsfc35i0TwRUR76VEuF/mrPzUU 3X3w==
MIME-Version 1.0
X-Received by 10.50.118.74 with SMTP id kk10mr18106016igb.2.1372720077128; Mon, 01 Jul 2013 16:07:57 -0700 (PDT)
Date Mon, 1 Jul 2013 17:07:57 -0600
Subject Regular expression negative look-ahead
From Jason Friedman <jsf80238@gmail.com>
To python-list <python-list@python.org>
Content-Type multipart/alternative; boundary=089e011821ea93190404e07b4c37
X-Mailman-Approved-At Tue, 02 Jul 2013 09:19:49 +0200
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4102.1372749590.3114.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1372749590 news.xs4all.nl 16007 [2001:888:2000:d::a6]:53987
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:49617

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

I have table names in this form:
MY_TABLE
MY_TABLE_CTL
MY_TABLE_DEL
MY_TABLE_RUN
YOUR_TABLE
YOUR_TABLE_CTL
YOUR_TABLE_DEL
YOUR_TABLE_RUN

I am trying to create a regular expression that will return true for only
these tables:
MY_TABLE
YOUR_TABLE

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.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Regular expression negative look-ahead Jason Friedman <jsf80238@gmail.com> - 2013-07-01 17:07 -0600
  Re: Regular expression negative look-ahead Neil Cerutti <neilc@norwich.edu> - 2013-07-02 12:15 +0000

csiph-web