gpt4 book ai didi

c - apr-utils apr_strmatch 正则表达式语法

转载 作者:太空宇宙 更新时间:2023-11-04 04:03:55 25 4
gpt4 key购买 nike

我想从 python 移植以下正则表达式:

HASH_REGEX = re.compile("([a-fA-F0-9]{32})")
if HASH_REGEX.match(target):
print "We have match"

使用 apr-utils apr_strmatch 函数的 C:

pattern = apr_strmatch_precompile(pool, "([a-fA-F0-9]{32})", 0);
if (NULL != apr_strmatch(pattern, target, strlen(target)) {
printf("We have match!\n");
}

问题是我不明白正则表达式(或方言)apr-utils apr_strmatch 函数使用的是什么语法。搜索文档和示例以无结果结束。

提前感谢您的建议...

最佳答案

apr_strmatch 根本不进行正则表达式匹配;它使用 Boyer–Moore–Horspool 进行普通子串搜索算法(参见 source)。

对于 C 中的 RE 匹配,尝试 PCRE .

关于c - apr-utils apr_strmatch 正则表达式语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8398210/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com