Noch ein kurzer Tipp an mich selbst, nach heute wieder überflüssigem rumgesuche und dem bösen Gedanken, die Phorward Foundation Library könnte hier einen Fehler haben.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
regex = pregex_create(); pregex_set_flags( regex, PREGEX_MOD_GLOBAL | PREGEX_MOD_NONGREEDY ); pregex_compile( regex, "'(\\\\.|[^\\\\\n'])*'", 0 ); if( ( match_cnt = pregex_match( regex, "A'\\''B'", &matches ) ) > 0 ) { for( i = 0; i < match_cnt; i++ ) { printf( "%d >%.*s<\n", matches[i].accept, matches[i].len, matches[i].begin ); } } regex = pregex_free( regex ); |
http://stackoverflow.com/questions/4166194/how-do-i-write-a-non-greedy-match-in-lex-flex