Regex for name until bracket or end
Posted: Sun Apr 19, 2015 6:05 pm
I am dealing with input that is a string containing a full name, many times over.
I am using regex to split the full name in to...
So, I need to reconstruct the regexs above so that each match is made on a full-name string that first looks to stop at the space preceding "(" or, else, the end of the full-name string.
How do I effectively combine these?
I am only just learning this stuff. No PHP needed - I only want to do this in regex if possible.
Many thanks.
I am using regex to split the full name in to...
- First name: ^\S*
- Middle name: \s+(.*\b)\s+
- Last name: \S+$
So, I need to reconstruct the regexs above so that each match is made on a full-name string that first looks to stop at the space preceding "(" or, else, the end of the full-name string.
How do I effectively combine these?
I am only just learning this stuff. No PHP needed - I only want to do this in regex if possible.
Many thanks.