Problem with perl group capture.

Discussion in 'Perl Misc' started by Googy, May 17, 2007.

  1. Googy

    Googy Guest

    Hi,

    I am executing two regex one after one. each one contains one group
    capture.

    The problem I am facing is after executing first regex I am getting a
    string into $1. After execting second regular expression $1 contains
    result from first regex execution.

    Kindly provide a solution if you have faced this kind of problem.

    Thanks.
    Googy, May 17, 2007
    #1
    1. Advertising

  2. On 17 May 2007 06:21:57 -0700, Googy <> wrote:

    >The problem I am facing is after executing first regex I am getting a
    >string into $1. After execting second regular expression $1 contains
    >result from first regex execution.


    Does the second regex also contain grouping. If not, then what you're
    seeing is expected. Otherwise, it's still expected, if the second
    regex did not match.

    >Kindly provide a solution if you have faced this kind of problem.


    *Which* problem? Are you perhaps forgetting to check whether the
    matches succeeded at all?


    Michele
    --
    {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
    Michele Dondi, May 17, 2007
    #2
    1. Advertising

  3. Googy

    Googy Guest

    On May 17, 7:06 pm, Michele Dondi <> wrote:
    > On 17 May 2007 06:21:57 -0700,Googy<> wrote:
    >
    > >The problem I am facing is after executing first regex I am getting a
    > >string into $1. After execting second regular expression $1 contains
    > >result from first regex execution.

    >
    > Does the second regex also contain grouping. If not, then what you're
    > seeing is expected. Otherwise, it's still expected, if the second
    > regex did not match.
    >
    > >Kindly provide a solution if you have faced this kind of problem.

    >
    > *Which* problem? Are you perhaps forgetting to check whether the
    > matches succeeded at all?
    >
    > Michele
    > --
    > {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    > (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    > .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    > 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


    Hi Thanks, found the problem, The regex has group capture but not
    matching at all.

    Thanks for your reply.
    Googy, May 21, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Max
    Replies:
    7
    Views:
    9,105
  2. Replies:
    3
    Views:
    1,562
  3. Jon Clements
    Replies:
    3
    Views:
    293
    Jon Clements
    Sep 17, 2010
  4. S. Robert James

    Regex group without capture

    S. Robert James, Feb 22, 2007, in forum: Ruby
    Replies:
    1
    Views:
    96
    Peña, Botp
    Feb 22, 2007
  5. naren

    group but do not capture

    naren, Feb 3, 2004, in forum: Perl Misc
    Replies:
    5
    Views:
    108
    naren
    Feb 5, 2004
Loading...

Share This Page