One more regular expressions question

harvey.thomas at informa.com harvey.thomas at informa.com
Thu Jan 18 06:40:55 EST 2007


Victor Polukcht wrote:

> My pattern now is:
>
> (?P<var1>[^(]+)(?P<var2>\d+)\)\s+(?P<var3>\d+)
>
> And i expect to get:
>
> var1 = "Unassigned Number "
> var2 = "1"
> var3 = "32"
>
> I'm sure my regexp is incorrect, but can't understand where exactly.
>
> Regex.debug shows that even the first block is incorrect.
>
> Thanks in advance.
>
> On Jan 18, 1:15 pm, Roberto Bonvallet <Roberto.Bonval... at cern.ch>
> wrote:
> > Victor Polukcht wrote:
> > > My actual problem is i can't get how to include space, comma, slash.Post here what you have written already, so we can tell you what the
> > problem is.
> >
> > --
> > Roberto Bonvallet

You are missing \( after the first group. The RE should be:

'(?P<var1>[^(]+)\((?P<var2>\d+)\)\s+(?P<var3>\d+)'




More information about the Python-list mailing list