Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<regex.h>
  3.  
  4. void main(int argc, char *argv[]) {
  5. regex_t regex;
  6. int res = regcomp (&regex, "[]0-9$*+?^]{1,63}", REG_EXTENDED);
  7. if(res)
  8. printf("error\n");
  9. else
  10. printf("success\n");
  11. res = regexec(&regex, argv[1], 0, NULL, 0);
  12. if (!res) {
  13. puts("Match\n");
  14. }
  15. else if (res == REG_NOMATCH) {
  16. puts("No match\n");
  17. }
  18. else {
  19. fprintf(stderr, "Regex match failed\n");
  20. }
  21. regfree (&regex);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement