Included regex.h and use the regcomp and regexec functions to do a regex based validation check on the user inputted username.
If the validation fails, the program displays the following message: Please enter a valid username (letters, numbers, underscores and dashes only) and then immediately exits. Including certain characters (such as &) will throw a shell-based error since they are special characters that are parsed separately before being passed into the program.
Associated Issue
Closes #4
Implemented Solution
Included
regex.h
and use theregcomp
andregexec
functions to do a regex based validation check on the user inputted username.If the validation fails, the program displays the following message:
Please enter a valid username (letters, numbers, underscores and dashes only)
and then immediately exits. Including certain characters (such as &) will throw a shell-based error since they are special characters that are parsed separately before being passed into the program.