in reply to Re^2: Regex to grab data after the work "branch from"
in thread Regex to grab data after the work "branch from"

Maybe you should try to fix up the regex? use re 'debug';

Replies are listed 'Best First'.
Re^4: Regex to grab data after the work "branch from"
by perl_mystery (Beadle) on Dec 14, 2010 at 07:58 UTC
    I created a sample script and used re 'debug',I really couldn't understand the output ...
    #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use re 'debug'; my $file= "//depot/asic/msmshared/users/QTVOEMDrops/7600/3555473R/qtv/ +player/audioplayer/audiocmx.cpp"; my $update_p4where=`p4 where $file`; #print "$update_p4where"; my $update_p4filelog=`p4 filelog $file`; print "$update_p4filelog\n"; my $update_base_branched_p4path = $update_p4filelog =~ /branch\sfrom(. +*\/(.*))\#\,(\#\d+)$/xmsg; print "$update_base_branched_p4path\n";

    Compiling REx `branch from(.*/(.*))\#,(\#\d+)$' size 30 first at 1

    1: EXACT <branchfrom>(5) 5: OPEN1(7) 7: STAR(9) 8: SANY(0) 9: EXACT </>(11) 11: OPEN2(13) 13: STAR(15) 14: SANY(0) 15: CLOSE2(17) 17: CLOSE1(19) 19: EXACT <#,>(21) 21: OPEN3(23) 23: EXACT <#>(25) 25: PLUS(27) 26: DIGIT(0) 27: CLOSE3(29) 29: MEOL(30) 30: END(0)

    anchored `branch' at 0 floating `#,#' at 12..2147483647 (checking anchored) minlen 16

    //depot/asic/msmshared/users/QTVOEMDrops/7600/3555473R/qtv/player/audioplayer/audiocmx.cpp ... #2 change 1548905 edit on 2010/12/09 by c_krisri@C_KRISRIXP (ktext) 'Audio loss when doing nultiple ' ... #1 change 1548876 branch on 2010/12/09 by c_krisri@C_KRISRIXP (ktext) 'Branching for orphan release fo' ... ... branch from //source/qcom/qct/multimedia/qtv/player/audioplayer/rel/1.1/src/audiocmx.cpp#1,#8

    Guessing start of match, REx `branch\sfrom(.*/(.*))\#,(\#\d+)$' against `//depot/asic/msmshared/users/QTVOEMDrops/7600/3555473R/qtv/p...'...

    Found anchored substr `branch' at offset 219... Contradicts floating substr `#,#', giving up...//Why is it giving up?why isn't it goint to the next line??

    Match rejected by optimizer Freeing REx: `branch\sfrom(.*/(.*))\#,(\#\d+)$'

      use YAPE::Regex::Explain; print YAPE::Regex::Explain->new( qr/branch\sfrom(.*\/(.*))\#\,(\#\d+)$/xms )->explain __END__ The regular expression: (?msx-i:branch\sfrom(.*/(.*))\#\,(\#\d+)$) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?msx-i: group, but do not capture (with ^ and $ matching start and end of line) (with . matching \n) (disregarding whitespace and comments) (case-sensitive): ---------------------------------------------------------------------- branch 'branch' ---------------------------------------------------------------------- \s whitespace (\n, \r, \t, \f, and " ") ---------------------------------------------------------------------- from 'from' ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- .* any character (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- / '/' ---------------------------------------------------------------------- ( group and capture to \2: ---------------------------------------------------------------------- .* any character (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \2 ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- \# '#' ---------------------------------------------------------------------- \, ',' ---------------------------------------------------------------------- ( group and capture to \3: ---------------------------------------------------------------------- \# '#' ---------------------------------------------------------------------- \d+ digits (0-9) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \3 ---------------------------------------------------------------------- $ before an optional \n, and the end of a "line" ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------

        I did try this,couldnt find any thing,I will keep trying but incase if someone finds any fault please let me know