rendered paste bodyint
main ( void )
{
char string[20] = "ah ah pouet prout" ;
regex_t * preg = ( regex_t * ) malloc ( sizeof ( regex_t ) ) ;
size_t nmatch ;
regmatch_t pmatch[50] ;
int i, j ;
if ( regcomp ( preg, "\\w{2} pouet", REG_EXTENDED ) )
printf ( "error regcomp\n" ) ;
if ( regexec ( preg, string, nmatch, pmatch, 0 ) )
printf ( "error regexec\n" ) ;
for ( i=0; i<50; i++ ){
if ( (pmatch[i]).rm_so == 0 && (pmatch[i]).rm_eo == 0 ){
i = 50 ;
break ;
}
for ( j=(pmatch[i]).rm_so; j<(pmatch[i]).rm_eo; j++ )
putc ( string[j], stdout ) ;
putc ( '\n', stdout ) ;
}
return 0 ;
}