#include
#include
#include
#include
#include
#include
#define IPEXPR "([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})"
int main(void) {
char line[1024];
char *address = NULL;
char delim[] = ",:;`/\"+-_(){}[]<>*&^%$#@!?~/|\\= \t\r\n";
int retval = 0;
regex_t re;
setlocale(LC_ALL, "");
if(regcomp(&re, IPEXPR, REG_EXTENDED) != 0)
return 1;
while((fgets(line, 1024, stdin)) != NULL) {
if(strchr(line, '.') == NULL)
continue;
address = strtok(line, delim);
while(address != NULL) {
if(strlen(address) <= 15)
if((retval = regexec(&re, address, 0, NULL, 0)) == 0)
printf("%s\n", address);
address = strtok(NULL, delim);
} /* while */
} /* while */
return 0;
}