Heh, I got ahead of myself anyway. I should have just hard-coded client.

preg_match('!/client(\d+)/!', $_SERVER['PHP_SELF'], $matches);
$xxx = $matches[1];

Ryan Schefke wrote:

Justin,

Very nice preg_match statement. I realized I need to make a minor tweek to
what I needed. I need to get the number after the "client" string in


/tgwedding/users/client1/sites/testgrabid.php

...so, in the string above I need to pull out the number "1".

Any help?

-----Original Message-----
From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 5:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Pulling out string from a string


Ryan Schefke wrote:


Can anyone help me with the code to pull out "clientxxx" from the below
string:

/tgwedding/users/client1/sites/testgrabid.php



I use $PHP_SELF to get the directory structure of the page and store that
string as a variable. Then, I want to pull out the string "clientxx",

where

"xx" can be any given number.

Thanks,
Ryan







preg_match('!/([^/]+\d+)/!', $_SERVER['PHP_SELF'], $matches);
$clientxxx = $matches[1];



--
paperCrane <Justin Patrin>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to