I have a list of names in this format: Luis Gonzalez\gonzalu01 |
Eddie Perez\perezed02 |
B.J. Surhoff\surhob.01 |
Bobby Bonilla\bonilbo01 |
Keith Lockhart\lockhke01 I want to extract the last names and separately extract what comes before each last name (which could be just the first name or two initials as in "B.J.") so that I can later organize them this way: First Last Luis Gonzalez Eddie Eddie B.J. Surhoff Bobby Bobby Keith Lockhart I do not need the data after the slash. How can I use GREF (REGEX) to extract the last names and separately the first/middle values? |
--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/59705c02-51c1-40da-ac1f-dda43d3f0d8c%40googlegroups.com.
Do the “last names” in your dataset always consist of the final word before the backslash? If so, you can use:
Find: (.*) (\S+)\\.*
Replace: \1\t\2
But eventually you will need to deal with names that don’t fit this pattern and then you will be sad. For example, in the name Saúl Rodriguez Luna, the “last name” is “Rodriguez Luna”.
You might want to read this:
https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
Hope this helps.
-sam
I have a list of names in this format:
B.J. Surhoff\surhob.01
Bobby Bonilla\bonilbo01
I want to extract the last names and separately extract what comes before each last name
(which could be just the first name or two initials as in "B.J.") so that I can later organize them this way:
B.J. Surhoff
Bobby Bobby
I do not need the data after the slash.
How can I use GREF (REGEX) to extract the last names and separately the first/middle values?
On 28 Feb 2020, at 16:00, I wrote:Replace all with \1 \2