Matching Names and Surnames

Let’s learn how to match names and surnames using regular expressions.

The utility presented in this lesson matches names and surnames, that is, strings that begin with an uppercase letter and continue with lowercase letters. The input should not contain any numbers or other characters.

Coding example

The function that supports the desired functionality is named matchNameSur() (defined in the nameSurRE.go) and is implemented as follows:

Get hands-on with 1200+ tech skills courses.