if (/(\s*\w\w)(\s+\w\w)?(\s+\w\w)?(\s+\w\w)?/) { # Do something }