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


Groups > comp.lang.python > #88688

Re: Get nesting of regex groups

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'example:': 0.03; 'url:pipermail': 0.05; 'detect': 0.07; 'nested': 0.07; 'skip:` 10': 0.07; 'stating': 0.09; '>on': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'portable': 0.16; 'presume': 0.16; 'reason.': 0.16; 'rogers,': 0.16; 'simpson': 0.16; 'url:html)': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'header:User- Agent:1': 0.23; 'cheers,': 0.24; "haven't": 0.24; 'source': 0.25; 'somewhere': 0.26; 'header:In-Reply-To:1': 0.27; 'writes:': 0.31; 'another': 0.32; 'url:python': 0.33; 'could': 0.34; 'but': 0.35; '+0200,': 0.36; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'ahead': 0.38; 'question,': 0.38; 'whatever': 0.38; 'to:addr :python-list': 0.38; 'that,': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'content-disposition:inline': 0.62; 'situation': 0.65; 'subject:Get': 0.68; 'article': 0.77; '2015': 0.84; 'chuck': 0.84; 'received:192.168.15': 0.84; 'regexp': 0.84; 'subject:groups': 0.84; 'obvious,': 0.91
Date Thu, 9 Apr 2015 08:00:33 +1000
From Cameron Simpson <cs@zip.com.au>
To python-list@python.org
Subject Re: Get nesting of regex groups
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii; format=flowed
Content-Disposition inline
In-Reply-To <mg46l7$2sr$5@dont-email.me>
User-Agent Mutt/1.5.23 (2014-03-12)
References <mg46l7$2sr$5@dont-email.me>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.152.1428530445.12925.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1428530445 news.xs4all.nl 2964 [2001:888:2000:d::a6]:59286
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:88688

Show key headers only | View raw


On 08Apr2015 21:30, Denis McMahon <denismfmcmahon@gmail.com> wrote:
>On Wed, 08 Apr 2015 22:54:57 +0200, Mattias Ugelvik wrote:
>
>> Example: re.compile('(?P<outer>(?P<inner>a))')
>>
>> How can I detect that 'inner' is a nested group of 'outer'? I know that
>> 'inner' comes later, because I can use the `regex.groupindex` (thanks to
>> your help earlier:
>> https://mail.python.org/pipermail/python-list/2015-April/701594.html).
>
>Pardon me for stating the obvious, but as the person defining the re, and
>assuming you haven't generated another sub-pattern somewhere in the same
>re with the same name, how can inner ever not be a nested group of outer?

If he has to ask this question, one might presume that he is not the source of 
the regexp. Ergo, he may not know the regexp structure ahead of time for 
whatever reason. I could invent scenarios for that, but perhaps Mattias can 
describe his situation some more.

Cheers,
Cameron Simpson <cs@zip.com.au>

In article <CF3rw3.n0x@eskimo.com> pirih@eskimo.com (Chris Pirih) writes:
| Wotsa zerk?

It's a portable hemispherical perforated spooge flange.
        - Chuck Rogers, car377@torreys.att.com

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


Thread

Get nesting of regex groups Mattias Ugelvik <uglemat@gmail.com> - 2015-04-08 22:54 +0200
  Re: Get nesting of regex groups Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-08 21:30 +0000
    Re: Get nesting of regex groups Cameron Simpson <cs@zip.com.au> - 2015-04-09 08:00 +1000
    Re: Get nesting of regex groups Mattias Ugelvik <uglemat@gmail.com> - 2015-04-08 23:58 +0200
    Re: Get nesting of regex groups Mattias Ugelvik <uglemat@gmail.com> - 2015-04-09 00:15 +0200

csiph-web