in reply to Not matching REGEX

By the way, /root/ means "contains 'root'", not "is 'root'". You'll get an undesired error if the user is astrootter. /root/ should be /^root\z/. The same problem exists in the other regexps too.