Re: Re: reg-ex again
| From: | John Fishworld | Date: | Mon, 29 Apr 2002 09:10:59 +0000 |
| Subject: | Re: Re: reg-ex again | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95114@lists.php.net to get a copy of this message | ||
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
>
> what about something simple as:
>
> $str = "/db/skod.gif";
>
> if (strpos($str, "/") == 0) {
> echo "Slash first";
> } else {
> echo "Slash not first";
> }
>
> --
> Henrik Hansen
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>