On Sat, 2011-01-01 at 09:46 +, Lester Caine wrote:
A slightly more complex problem than phone numbers ...
It is a sort of convention to use the format 'JohnDoeSMITH' or 'John Doe
SMITH'
where each forename starts with a capital and the surname is in upper case. I
have a crude method of scanning for the capitals and splitting this to give
me
an array of name segments with [0] as the Surname and a variable number of
Forenames, but is there an 'elegant' way via regex to extract this into an
array?
--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
I wouldn't try and do this with a regex, it would just become too
complicated. What about people with no middle name, or multiple middle
names? How do you deal with double-barrelled names like John
Walter-Smythe Doe? You would be far better off using multiple input
boxes for this sort of thing, and then format it as required when
outputting the data.
Thanks,
Ash
http://www.ashleysheridan.co.uk