On Friday, August 15, 2003, at 04:55 PM, Scott Taylor wrote:

At 02:28 PM 08/15/2003, James Edward Gray II wrote:
On Friday, August 15, 2003, at 04:20 PM, Scott Taylor wrote:


Any one have or know of a function to convert ugly "NAME, USER" to "User Name"?

Maybe something like:


s/^(\w+), ?(\w+)$/ucfirst(lc $2) . ' ' . ucfirst(lc $1)/e

Nice, very useful! Only now I have a small problem with names like "O'CONNELL, BOB"

Yes you do! :) The ' character isn't covered under my \w above. I'll switch it to a character class to show how to fix it, but you may need to refine it a little further.


s/^([A-Z'] +), ?([A-Z']+)$/ucfirst(lc $2) . ' ' . ucfirst(lc $1)/e

Hope that helps.

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to