-----Original Message----- From: Steve Slater [mailto:[EMAIL PROTECTED] Sent: Saturday, March 12, 2005 5:29 PM
$name_array = explode(" ",$name); $short_name = "$name_array[0] " . end($name_array); > And a dozen other ways to do it I'm sure. I just finished a > project with a mess of pattern matching so have regex on the brain. :-) Hehe, I know the feeling Ereg solution: eregi("^([a-z] ).* ?([a-z])$", $name, $regs); print "the name in short is $regs[1] $regs[2]"; But when dealing with names I think Your approach is better since there´s all kinds of chararcters from language to language, in Denmark ÆæØøÅå, in sweden äÄöÖ and so on. Of course I could do something like: ereg("^(.+ ).* ?(.+)$", $name, $regs); // untested -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler Naverland 31 DK-2600 Glostrup www.comx.dk Telefon: +45 70 25 74 74 Telefax: +45 70 25 73 74 E-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php