All pastes #963085 Raw Edit

Anonymous v2

public c v1 · immutable
#963085 ·published 2008-03-30 05:59 UTC
rendered paste body
#include <stdio.h>#include <regex.h>int main(){	char string[100];	int word=0;	char *cp;	printf("Enter a string\nString: ");	fgets(string,sizeof(string),stdin);	cp = string;	ret = regcomp( &re, "\\<\\w+\\>", REG_EXTENDED ); // TODO check ret	ret = regexec( &re, cp, 1, &pm, 0);	while (ret == 0) {  		word++		cp += pm.rm_eo;		ret = regexec( &re, cp, 1, &pm, REG_NOTBOL);	}	regfree(&re);	printf("yeah %d words\n"word);	return 0;}