in reply to Regex: Matching last of repeated character to end of string
There are three approaches I can think of that would solve your issue, and only one is a regex.
$xpath =~ s{/[^/]+$}{};
my @temp = split('/', $xpath); $xpath = join('/',@temp[0..$#temp-1]);
$xpath = substr($xpath,0,rindex($xpath,'/'));
The last one (rindex) strikes me as the most efficent way to go, but I haven't Benchmarked it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex: Matching last of repeated character to end of string
by japhy (Canon) on Nov 04, 2005 at 15:04 UTC |