#include <stdio.h>
#include <regex.h>        
#include <stdlib.h>
 
#define REGEX "prefix:\\w+,\\w+,\\s*-?[0-9]{1,4}\\s*,\\s*-?[0-9]{1,4}\\s*,\\s*-?[0-9]{1,4}\\s*,\\w*"
 
const char *input = "prefix:string,string,-100,100,0,string";
int main(){
 
    int rc;
 
    regex_t regex;
 
    rc = regcomp(&regex, REGEX, REG_EXTENDED);
    if (rc != 0) {
        fprintf(stderr, "Could not compile regex\n");
        exit(1);
    }
 
    rc = regexec(&regex, input, 0, NULL, 0);
    if (rc == 0) {
        printf("Match!\n");
        return 0;
    }
    else if (rc == REG_NOMATCH) {
        printf("No match\n");
        return -1;
    }
    else {
        perror("Error\n");
        exit(1);
    }
 
    return 0;
}