Re: Re: reg-ex again
| From: | Jason Wong | Date: | Mon, 29 Apr 2002 09:18:54 +0000 |
| Subject: | Re: Re: reg-ex again | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95118@lists.php.net to get a copy of this message | ||
On Monday 29 April 2002 17:10, John Fishworld wrote:
> No the problem is I'm reading a file into an array and then need
> to change any of the links in the file from relative links to absolute
> links !
> So that my lg_mode.gif gets the full server path in front of it
> http://www.ltest.com/lg_mode.gif
>
> and exactly the same with the other one but of course I don't won't
>
> http://www.test.com//folder/name.gif
>
> > > I'm trying to find files in my array
> > > for example
> > > ="lg_imode.gif"
> > > and
> > > ="/db/imodeklein/edgar-IMODE-1-.gif"
> > >
> > > I want to differentiate between the files with slash at the front and
>
> ones
>
> > > without so that
> > > I can add a server path !
> > > but as usual I' m having problems with the correct regex
Not sure if I understand your problem correctly.
Define your server path as: http://www.myserver.com/some/path (NB no
trailing slash)
If the first char of file contains '/' use:
"$server_path$file"
otherwise use:
"$server_path/$file"
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Why is the alphabet in that order? Is it because of that song?
-- Steven Wright
*/