I've been creating a regex to catch a person's name from a larger chunk of tex twith this following format:
Last Name, First Name and Additional Names (2 Additional Names Maximum)
No Additional special characters except for comma (,)
Only Names that can be derived from English alphabet [A-Z]|[a-z]
Example of Format Name:
Johnson, Carl
Scott, Michael Mark
Smith, Robert Angelo John
- The first Example contains only Last Name and First Name
- The second Example contains Last Name, First Name and Additional Name
- The third Example contains Last Name, First Name and two Additional Names
So far, I've been on trial and error in Regex and this is my current regex:
^([A-z]|[a-z])*[,][\s]*([A-z]|[a-z]|[\s])*