Re: Getting part of a string
| From: | debbie_dyer | Date: | Fri, 27 Sep 2002 15:48:11 +0000 |
| Subject: | Re: Getting part of a string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117862@lists.php.net to get a copy of this message | ||
I'm not an expert on regex but this seems to work:-
ereg("^/[^/]*/([^/]*)/.*$", "/realtor/Remax/Ed/files/", $regs);
if (isset($regs[1])) {
print $regs[1];
}
Debbie
----- Original Message -----
From: <ed@home.homes2see.com>
To: <php-general@lists.php.net>
Sent: Friday, September 27, 2002 4:23 PM
Subject: [PHP] Getting part of a string
>
> I've got a situation where I need to pull a string from a variable but I
> can't seem to get it figured out.
>
> I.e.
>
> value of $a = /realtor/Remax/Ed/files/
>
> I need to get the string between the second and third / (slash)
>
> What I need: Remax
>
> Thanks,
>
> Ed
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>