P
peter pilsl
the following substitution does not what I want. So I ask myself where
the knot in my brain is this time.
I want to clean up urls and make a/b/c/../e/f => a/b/e/f
$a="a/b/c/../e/f";
$a=~s,/(.*?)/\.\./,/,;
print $1,"\n",$a,"\n"
which gives:
b/c
a/e/f
Thats still to greedy to me
my desired match would be "c"
Is there a way to achieve this? Maybe some look-behind-hack? I'm not
familiar with this.
My alternative approach would be to simply split the whole stuff and
iterate throught it. This approach - however - seems to be more
costintensive than I'd like it to be.
thnx,
peter
the knot in my brain is this time.
I want to clean up urls and make a/b/c/../e/f => a/b/e/f
$a="a/b/c/../e/f";
$a=~s,/(.*?)/\.\./,/,;
print $1,"\n",$a,"\n"
which gives:
b/c
a/e/f
Thats still to greedy to me
Is there a way to achieve this? Maybe some look-behind-hack? I'm not
familiar with this.
My alternative approach would be to simply split the whole stuff and
iterate throught it. This approach - however - seems to be more
costintensive than I'd like it to be.
thnx,
peter