A Perl RE question: I want to extract the path up to the first occurrence within the path of any one of the alternatives specified:
#Possible subdir names $fruits= "apple|orange|peach"; #Possible path names maybe: $dir= ".../.../<fruit1>/<fruit2>"; #Or $dir= ".../.../<fruit1>/blah/<fruit2>"; #where <fruitN> is any one among $fruits. If I used a RE like the following: $dir =~ m,^(.*)/($fruits)/,; I get a greedy match, upto & including the last occurrence. Is there a RE to get the path up to the first occurrence of any one of the alternatives? I know I can do it by splitting the path into pieces and searching for the first occurrence & joining, but I was hoping for a single RE solution. Thanks, -Nilanjan _______________________________________________ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm