jmakhack / myanimelist-cli

Minimalistic command line interface for fetching user anime data from MyAnimeList.
https://aur.archlinux.org/packages/mya-git
MIT License
11 stars 15 forks source link

Username char validation #18

Closed jmakhack closed 3 years ago

jmakhack commented 3 years ago

Associated Issue

Closes #4

Implemented Solution

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.