Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: URL resolve (operations on path etc.)

by harangzsolt33 (Chaplain)
on Jul 31, 2022 at 11:31 UTC ( [id://11145866]=note: print w/replies, xml ) Need Help??


in reply to Re: URL resolve (operations on path etc.)
in thread URL resolve (operations on path etc.)

Could this be resolved with a regex maybe? Like for example:

#!/usr/bin/perl use strict; use warnings; my $PATH = 'http://a.com/a/b/c/d/e.json?something' . '/' . '/../../../ +'; $PATH =~ tr|/||s; my $PREV = 0; my $LEN; for (;;) { $PATH =~ s/\/[^\/]+\/\.\.//; $LEN = length($PATH); last if ($PREV == $LEN); $PREV = $LEN; } print $PATH;

I put the regex in a for(;;) loop, because adding global flag didn't do what I want:

$PATH =~ s/\/[^\/]+\/\.\.//g;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11145866]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-23 22:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found