View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Regular Expressions & Middle Name

On Fri, 20 Jul 2007 10:14:13 -0700, wrote:

I am new to regular expressions and trying to understand a little
better. I have a formula that Ron Rosenfeld wrote The first one will
Parse the middle initial followed by a dot (A.) and the second one
will parse the middle initial the (A) .How do I get one formula to
parse a middle initial if it has a . or not?

Thanks in advance
PJ

Jim A. Jones
Jim A Jones


=REGEX.MID(TRIM(A2),"(?<=\s)(\w.+\s)+")

=REGEX.MID(TRIM(A3),"(?<=\s)(\w+\s)+")


Well, here is a function that works by removing the First and Last words in the
string. So it should return middle name(s) or initial(s) with or without the
'.'

But there are many variables. For example:

John Paul de la Hoya

John P. X. de la Hoya

My wife has a first name, a conjunction, three middle names and a last name.

It's almost impossible to define a routine unless you can precisely define all
the variations.

--ron