首页 > 解决方案 > pcre的结构信息

问题描述

我有以下函数来编译pcre正则表达式:

/**
 * common options: PCRE_DOTALL, PCRE_EXTENDED, PCRE_CASELESS, PCRE_MULTILINE
 * full options located at: https://man7.org/linux/man-pages/man3/pcre_compile.3.html
 */
pcre* pcre_compile_pattern(const char* pattern, int options)
{
    const char *pcre_error;
    int error_offset;
    pcre *re_compiled = pcre_compile(pattern, options, &pcre_error, &error_offset, NULL);
    if (re_compiled == NULL) {
        fprintf(stderr, "ERROR: '%s' occurs at pattern position %d\n", pcre_error, error_offset);
    }
    return re_compiled;
}

有没有描述结构的地方pcre?例如,我正在查看它是否包含pattern(作为普通字符串)在其中,或者我是否必须单独保留模式。我在手册页中看到了很多参考资料,pcre*但我真的无法获得有关该结构的更多详细信息。

在搜索 github 时,我可以找到一个地方,这似乎是我正在使用的:https ://github.com/luvit/pcre/blob/e2a236a5737b58d43bf324208406a60fe0dd95f4/pcre_internal.h#L2317 。一切都是私有的,所以你不能访问结构的一部分,例如直接读取/打印它。

标签: cregexpcre

解决方案


推荐阅读