Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
On Jul 21, 8:00 pm, "Harlan Grove" wrote:
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? ... Jim A. Jones Jim A Jones =REGEX.MID(TRIM(A2),"(?<=\s)(\w.+\s)+") =REGEX.MID(TRIM(A3),"(?<=\s)(\w+\s)+") These aren't robust, and they include trailing spaces. The following will give all middle initials, names, whatever, without trailing spaces. =REGEX.SUBSTITUTE(A1,"^\s*\S+\s*(.+)*\s+\S+\s*$","[1]") If you want only initials, =REGEX.SUBSTITUTE(REGEX.SUBSTITUTE(A1,"^\s*\S+\s*( .+)*\s+\S+\s*$","[1]"), "\S+[^\s.]\s*","") Thank you very much Harlan. I appreciate all of your knowledge on this and any other subject. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VB Script Regular Expressions - Missing | Excel Discussion (Misc queries) | |||
Substring in excel? How about regular expressions? | Excel Discussion (Misc queries) | |||
Excel 'Special' Characters in Expressions | Excel Worksheet Functions | |||
Regular expressions in Excel | Excel Discussion (Misc queries) | |||
Sorting columns with expressions | New Users to Excel |