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: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> 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 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php