I am trying to convert name of a certain format to FirstName Lastname. My regex is not working for all scenarios.
Regex I am using is: ^(\w+).*?(\w+)$
Parsing into 2 names and concatenating them. However, this is not working for cases 1 and 4.
Example: Trying to get Oscar Wilde from
| Wilde, Oscar A. |
| Wilde, Oscar |
| Wilde Jr, Oscar |
| Wilde Jr, Oscar Senior |