Skip to content

Instantly share code, notes, and snippets.

@venj
Created December 22, 2015 08:51
Show Gist options
  • Save venj/6b6780195c22983b671b to your computer and use it in GitHub Desktop.
Save venj/6b6780195c22983b671b to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <regex.h>
#include <unicode/uregex.h>
int main(int argc, char const *argv[])
{
regex_t regex;
if (regcomp(&regex, "\\w+", REG_ICASE | REG_EXTENDED)) {
printf("Error compile\n");
exit(255);
}
char *str = "1212131www31212";
int matches = 0;
int errorcode = regexec(&regex, str, matches, NULL, 0);
if (errorcode) {
printf("Error exec: %d\n", errorcode);
exit(255);
}
printf("Matches found.\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment