in reply to split function using multiple delimiters
This task has two parts.
The first part is to split the string to a list of individual names. They're separated by commas and the word "and". This is possible, and you almost got it right. Try something like
There are two important point here: don't use a capturing parenthesis in the regex (if you must use grouping, use (?: ) non-capturing groups), and make sure to find and only if it's a separate word, not when it's inside a name.split /(?:\s+and\s+|\s*,\s*|\s*,\s*and\s+)/
The second part of the task is to take each name and break it to a surname and given name. That is, sadly, impossible.
|
|---|