Validate Name

RegExp to validate the input of a person's name.

Validate Name
/**
 * CAUTION: Don't test on large inputs. Apply it to inputs filtered by length limit.
 *
 * Can be used to test firstName/lastName/fullName
 *
 * Grammar Rules:
 * - Should start with a alphabet
 * - In middle,
 *   - can contain any number of alphabets,
 *   - or a `'`(quote) or ` `(space) followed by one or more alphabets,
 *   - or `.`(dot) followed by a ` `(space) and one or more alphabets
 * - Should end with a alphabet, or a `.`(dot).
 *
 * Allowed Examples:
 * - A
 * - A B
 * - A B C (so on)
 * - A.
 * - A. B.
 * - A. B. C. (so on)
 * - Edyth O'Keefe
 * - Mr. David
 * - Robert Downey Jr.
 *
 */
export const NAME_REG_EXP = new RegExp(
  /^[a-zA-Z]+(([' ][a-zA-Z])?([.][ ][a-zA-Z])?[a-zA-Z]*)*[.]?$/
);