I am trying to use a regex to determine if a provided file has the .csv extension.
#include #include int match(const char *strin
The regex you are using is not valid for the regex flavor: the hyphen must be used at the start/end of the bracket expression. Also, you need to escape the dot, else, it will match any char.
Use
const char *reg = "^[a-zA-Z0-9_-]+\\.csv$";
See the C demo.