On 2014-07-01, Florian Lindner wrote:
>
> Is there a way I can extract the named groups from a regular
> expression? e.g. given "(?P\d)" I want to get something
> like ["testgrp"].
The match object has an attribute called "groupdict", so you can get
the found named groups using match.groupdict.k
On Tue, Jul 1, 2014 at 8:58 AM, Chris Angelico wrote:
> On Wed, Jul 2, 2014 at 1:29 AM, Peter Otten <__pete...@web.de> wrote:
>> Easy, just write a regular expression to parse regular expressions ;)
>
> Hmm, is that even possible? AIUI you can't make a regex that correctly
> parses nested tokens,
On Tuesday, 1 July 2014 16:12:34 UTC+1, Florian Lindner wrote:
> Hello,
>
>
>
> Is there a way I can extract the named groups from a regular expression?
>
> e.g. given "(?P\d)" I want to get something like ["testgrp"].
>
>
>
> OR
>
>
>
> Can I make the match object to return default val
Chris Angelico wrote:
> On Wed, Jul 2, 2014 at 1:29 AM, Peter Otten <__pete...@web.de> wrote:
>> Easy, just write a regular expression to parse regular expressions ;)
>
> Hmm, is that even possible? AIUI you can't make a regex that correctly
> parses nested tokens, and named groups can definitely
On 2014-07-01 16:12, Florian Lindner wrote:
Hello,
Is there a way I can extract the named groups from a regular expression?
e.g. given "(?P\d)" I want to get something like ["testgrp"].
OR
Can I make the match object to return default values for named groups, even
if no match was produced?
i
On Wed, Jul 2, 2014 at 1:29 AM, Peter Otten <__pete...@web.de> wrote:
> Easy, just write a regular expression to parse regular expressions ;)
Hmm, is that even possible? AIUI you can't make a regex that correctly
parses nested tokens, and named groups can definitely be nested.
ChrisA
--
https://
Florian Lindner wrote:
> Is there a way I can extract the named groups from a regular expression?
> e.g. given "(?P\d)" I want to get something like ["testgrp"].
Easy, just write a regular expression to parse regular expressions ;)
(Sorry, I can't contribute something constructive, my first idea
Hello,
Is there a way I can extract the named groups from a regular expression?
e.g. given "(?P\d)" I want to get something like ["testgrp"].
OR
Can I make the match object to return default values for named groups, even
if no match was produced?
Thanks,
Florian
--
https://mail.python.org/m