|
Posted by Rik on 06/13/06 07:33
moxie19@gmail.com wrote:
> Hello,
>
> It's my first post, hopefully I can get some help here.
>
> I have a string like: $var1 = "John A. Smith"
> What I am looking to do is extract the first name out of the entire
> string into a new variable, so it would be something like this: $var2
> = "John"
>
> Anybody know an easy way to accomplish this?
preg_match('/^([0-9a-z]+)\b/i',$string, $vars);
Grtz,
--
Rik Wasmus
[Back to original message]
|