Re: Splitting a string ...

From: Date: Mon, 15 Mar 2010 13:28:53 +0000
Subject: Re: Splitting a string ...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-302851@lists.php.net to get a copy of this message
Here is the regex for you. $company_domain = '\w+'; // replace with your own company domain pattern. $user_name = '\w+'; // replace with your own username pattern $email_domain = '\w+\.\w{2,4}'; // google for standard domain name regex pattern and replace it. $regexp = "~({$company_domain}[\\\\/])?(?P<username>$user_name)(@$email_domain)?~"; preg_match($regexp, $text, $matches); print_r($matches); // $matches['username'] will contain username. -- Shiplu Mokaddim My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

« previous php.general (#302851) next »