Re: reg-ex again
| From: | Henrik Hansen | Date: | Mon, 29 Apr 2002 08:34:30 +0000 |
| Subject: | Re: reg-ex again | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95110@lists.php.net to get a copy of this message | ||
john@webital.de (John Fishworld) wrote:
> 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