/^([A-Za-z]+\s+[A-Za-z]+|[A-Za-z]+)$/
it matches a string that is a sequence of letters and spaces (a name). The first part of the regex (before the vertical bar) matches a string that starts with one or more letters, that is followed by a space, and that is followed by one or more letters. The second part of the regex (after the vertical bar) matches a string that is composed of one or more letters.