C > Miscellaneous
Print all urls found in text file
Print all urls found in text file #include
#include
#include
#include
#include
#include
int main(void) { char line[1024]; char delim[] = "<> \t\n"; char *word = NULL; int retval = 0; regex_t re; setlocale(LC_ALL, ""); if(regcomp(&re, "href", REG_ICASE) != 0) return 1; while((fgets(line, 1024, stdin)) != NULL) { word = strtok(line, delim); while(word != NULL) { if((retval = regexec(&re, word, 0, NULL, 0)) == 0) printf("%s\n", word); word = strtok(NULL, delim); } } return 0; }
C Codes
Beginners
C on Unix
Code Snippets
Data Structures
File Operations
Games Graphics
Gnu-Linux
Hardware
Mathematics
Miscellaneous
Small Programs
Sorting