perl_mystery has asked for the wisdom of the Perl Monks concerning the following question:

I am getting the following error when using the below expression,where am I going wrong?

Unmatched ( before HERE mark in regex m/branch from( << HERE .*/ at perl.pl line 38.

I have a variable "$p4filelog" which has the below data,now

1. I want to match only the data after the word "branch from" in the below data,in this case just match"//source/qcom/qct/multimedia/qtv/player/audioplayer/rel/1.1/src/file.cpp#1,#8"

2.From "//source/multimedia/qtv/player/audioplayer/rel/1.1/src/file.cpp#1,#8",remove "#1,",finally the output should be "//source/multimedia/qtv/player/audioplayer/rel/1.1/src/file.cpp#8"

3.I looked at CPAN to find if there are any built-in modules to find the branched history of a file,couldn't find any,any of you guyz are aware of such modules?

p4filelog data below

//depot/asic/msmshared/users/QTVOEMDrops/qtv/player/audioplayer/file.cpp

... #2 change 1548905 edit on 2010/12/09 by sri@SRIXP (ktext) 'Audio loss when doing nultiple '

... #1 change 1548876 branch on 2010/12/09 by sri@SRIXP (ktext) 'Branching for orphan release fo'

... ... branch from //source/qcom/qct/multimedia/qtv/player/audioplayer/rel/1.1/src/file.cpp#1,#8

$Branched_p4path = $p4filelog =~ /branch from(.*/(.*))\#\,(\#\d+)$/;

Replies are listed 'Best First'.
Re: Regex to grab data after the work "branch from"
by chrestomanci (Priest) on Dec 14, 2010 at 09:14 UTC

    You asked a very similar question a few days ago:

    Regex to grab data after the work "branch from"

    Last time Corion suggested you take a look on CPAN with the search term P4. What did you find when you searched? How have you used that information to solve your problem?

    By asking the same question again, without referring to your previous question or it's responses, it looks like you are ignoring our advice, and trying to get us to write code for you. If you are stuck with a problem, then we are happy to help, but we are not here to do your job for you.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Regex to grab data after the work "branch from"
by Anonyrnous Monk (Hermit) on Dec 14, 2010 at 01:48 UTC
    /branch from(.*/(.*))\#\,(\#\d+)$/; ^

    Either escape the slash, or use a different delimiter, e.g. m|...|

    (Also, '#' isn't a regex metacharacter (unless you use /x), so no need to escape it here.)

      The error is gone but I dont see any data getting printed

      p4filelog data below,$update_p4filelog has below data

      //depot/asic/msmshared/users/QTVOEMDrops/qtv/player/audioplayer/file.cpp

      ... #2 change 1548905 edit on 2010/12/09 by sri@SRIXP (ktext) 'Audio loss when doing nultiple '

      ... #1 change 1548876 branch on 2010/12/09 by sri@SRIXP (ktext) 'Branching for orphan release fo'

      ... ... branch from //source/qcom/qct/multimedia/qtv/player/audioplayer/rel/1.1/src/file.cpp#1,#8

      $update_p4filelog=`p4 filelog $1`; print "$update_p4filelog\n";# $update_base_branched_p4path = $update_p4filelog =~ /branch from(.*\/( +.*))\#\,(\#\d+)$/xmsg; print "$update_base_branched_p4path\n";# doesnt print anything,expecti +ng //source/qcom/qct/multimedia/qtv/player/audioplayer/rel/1.1/src/file.c +pp#8 to be printed
        Maybe you should try to fix up the regex? use re 'debug';
        .../file.cpp#1,#8 ^ ...\/(.*))\#\,(\#\d+)$/ ^

        You don't have anything in your regex that would match the 1.