[thelist] Directory names
Chris Platts
chris.platts at virelai.co.uk
Wed Nov 26 14:28:56 CST 2003
On Nov 25, 2003, at 06:37 pm, Guy Bowden wrote:
> Hi,
>
> If I've got a folder string in PHP like this:
>
> /546/guy/datasrc/./../email/sendtofriend/
>
> How can I turn that into :
>
> http://darkside/546/guy/email/sendtofriend/
Regular expression replacement has to be the way to go. In perl I would
do something like:
-------------------------------------------------------
#!/usr/bin/perl -w
$x = '/546/guy/datasource/./../email/sendtoafriend/';
$x =~ s|(.*)/datasource/./../(.*)|http://darkside$1/$2|;
print $x;
-------------------------------------------------------
I am sure PHP can do something similar, perhaps using ereg_replace().
Chris
--
Chris Platts
Web Developer
Cancer Research UK
More information about the thelist
mailing list