문제
pcre_compile 및 pcre_exec을 사용할 때 케이스를 어떻게 무시합니까?
pcre_exec(
pcre_compile(pattern,0,&error,&erroroffset,0),
0, string, strlen(string), 0, 0, ovector, sizeof(ovector));
어떤 옵션을 사용하고 어디에 지정합니까?
해결책
당신은 통과해야합니다 PCRE_CASELESS
두 번째 논쟁에서 pcre_compile
, 이와 같이:
pcre_compile(pattern, PCRE_CASELESS, ...
(거기에서 메모리가 새고 있습니다. 전화해야합니다. pcre_free
반환 된 물체에 pcre_compile
.)
다른 팁
당신은 사용할 수 있습니다 PCRE_CASELESS
pcre_compile의 플래그.
예시:
pcre_compile(
pattern, /* the pattern */
PCRE_CASELESS|PCRE_MULTILINE, /* default options */
&error, /* for error message */
&erroffset, /* for error offset */
NULL); /* use default character tables */
제휴하지 않습니다 StackOverflow