Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #49604
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!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 | OK 0.196 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.63; '*S*': 0.02; 'subject:Regular': 0.16; 'subject:expression': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'seems': 0.21; 'email addr:gmail.com>': 0.22; 'form:': 0.24; 'why.': 0.24; 'mon,': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'message-id:@mail.gmail.com': 0.30; 'work:': 0.31; 'regular': 0.32; 'to:name:python-list': 0.33; 'table': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'jason': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'sure': 0.39; '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; 'jul': 0.74; 'capture': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ym38NFUvd9mHHpJGM8ZXCkYbLFzq/m7lcJejbhUGdeo=; b=QqP8HEaRtzbXfPeKTaPjhyybKhoODSH46Ctf/eXk5UvScx8o5oJwO8RYsr26VGV2/d xxbdEo2RSaHiGBOuRfdWuod3s0mai0hD288LqWtQZFy1ltfzu9vs+LZDZx9Bj5PhcFSn OlbyuBpMbwTae+FhyH3he9t8lVlZUKQp8ZL7Q1mxSAOFdnskCEabje5JjGIdZ6ZOt8xy mtkCrbnZemiH3LXvx4GqD48+QOACEwRZTZJDf2VPoqOAClsebAwT0WwEx7syvDOlX5NO qUmLcbUJ789WtemaQC4B1H1KH7u1ho8C74Hdzd6np5Ne0GycPhhRrfPdl2b9i40axOcE lYig== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.73.106 with SMTP id k10mr18058940igv.31.1372732071943; Mon, 01 Jul 2013 19:27:51 -0700 (PDT) |
| In-Reply-To | <CANy1k1iGTYjAVzTnNegXuW9FaoqZsXe1z8TMhzAN1VYeyDUnSQ@mail.gmail.com> |
| References | <CANy1k1iGTYjAVzTnNegXuW9FaoqZsXe1z8TMhzAN1VYeyDUnSQ@mail.gmail.com> |
| Date | Mon, 1 Jul 2013 20:27:51 -0600 |
| Subject | Re: Regular expression negative look-ahead |
| From | Jason Friedman <jsf80238@gmail.com> |
| To | python-list <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=089e013a0e028526e504e07e17bf |
| 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.4087.1372733782.3114.python-list@python.org> (permalink) |
| Lines | 74 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1372733782 news.xs4all.nl 15867 [2001:888:2000:d::a6]:33154 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:49604 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Found this: http://stackoverflow.com/questions/13871833/negative-lookahead-assertion-not-working-in-python . 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@gmail.com> wrote: > 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 | Next | Find similar | Unroll thread
Re: Regular expression negative look-ahead Jason Friedman <jsf80238@gmail.com> - 2013-07-01 20:27 -0600
csiph-web