in reply to Re^2: Problem in pattern matching with alternation
in thread Problem in pattern matching with alternation

First of all, "/" is slash, "\" is backslash. Having two slashes in path (for Unix like) means that the path has two parts. Saying "2 '\\'" means (at least to me) there are two pairs of adjacent '\', that is "\\" and "\\" :-)

OK, back to the problem...
I tend to think that you want the last part of the path which you can use basename functionality. So,

while (<DATA>) { chomp; (my $tag = (split)[0]) =~ s!.*(/.*)\.vbs$!$1!; print $tag, "\n"; } __DATA__ /usr/add-on/puccase_vob01/ccvob01/bt_rel.vbs public /usr/add-on/puccase_vob01/ccvob01/scm.vbs /usr/add-on/puccase_vob01/ccvob01/v_dialerclient_rel.vbs
would result in
/bt_rel /scm /v_dialerclient_rel
But, I'm confused with /vobs/bt_rel. Where the /vobs part comes from?

Update: The problem with your code is that you are trying to track the path level manually, and using regex complicates the situation.

Update2: I just noticed that the leading asterisks are part of the lines, followed by some space(s) then the tags. Here is my modified code:

$ cat extract-vobtags.pl while (<DATA>) { chomp; my($tag, $storage) = (split)[1,2]; printf "%20s: %s\n", $tag, $storage; } __DATA__ * /vobs/bt_rel /usr/add-on/puccase_vob01/ccvob01/bt_rel.vbs public (re +plicated) * /scm /usr/add-on/puccase_vob01/ccvob01/scm.vbs public (replicated) * /v_dialermidtier /usr/addon/puccase_vob01/ccvob01/v_dialermidtier.vb +s public (replicated) * /v_dialer /usr/add-on/puccase_vob01/ccvob01/v_dialer.vbs public (rep +licated) * /vobs/UMTools /user/addon/puccase_vob01/ccvob01/UMtools.vbs replicat +ed) $ perl extract-vobtags.pl /vobs/bt_rel: /usr/add-on/puccase_vob01/ccvob01/bt_rel.vbs /scm: /usr/add-on/puccase_vob01/ccvob01/scm.vbs /v_dialermidtier: /usr/addon/puccase_vob01/ccvob01/v_dialermidtier +.vbs /v_dialer: /usr/add-on/puccase_vob01/ccvob01/v_dialer.vbs /vobs/UMTools: /user/addon/puccase_vob01/ccvob01/UMtools.vbs

Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!