#include <pcre.h> 
#include <string.h> 

int main(int argc, char **argv) 
{ 
	pcre *re = NULL; 
	pcre_extra *pe = NULL; 
	const char *error = NULL; 
	int erroffset; 
	int ovector[30]; 
	int matches; 
	const char *match_string; 
	const char *subject = "Esta es una prueba\nEsta es otra linea\ny otra"; 
	int x; 

	re = pcre_compile("(\\S+)\\s*:\\s*(\\S+)", 0, &error, &erroffset, NULL); 

	matches = pcre_exec(re, NULL , subject, strlen(subject), 0, 0, ovector, 30); 
	printf("subject=\"%s\", matches=%d\n", subject, matches); 
	for (x=0 ; x < matches ; x++) 
	{ 
		pcre_get_substring(subject, ovector, matches, x, &match_string); 
		printf("match %d: \"%s\")\n", x, match_string); 
		pcre_free_substring(match_string); 
	} 
	return 0; 
}


