Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Answer: How do I change .. to the real filename?

by Shakya (Initiate)
on Oct 06, 2007 at 18:59 UTC ( #643140=categorized answer: print w/replies, xml ) Need Help??

Q&A > regular expressions > How do I change .. to the real filename? - Answer contributed by Shakya

You can even try this -
1 while ($string =~ s!(/(?:[^/.]+/)*)((?:[^/.]+/)+\.\./?)(.*)$!$1$3!g) +;

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[LanX]: ... and it might be your last chance ... I heard Perl is dead! OO
[marto]: someone read the post about search.cpan being shut down, and commented "It's going to be awhile before I learn to not type "cpan.org" into my address bar."

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2018-06-20 09:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (116 votes). Check out past polls.

    Notices?