apr-utils apr_strmatch 正则表达式语法
将以下正则表达式从 python: 移植
HASH_REGEX = re.compile("([a-fA-F0-9]{32})")
if HASH_REGEX.match(target):
print "We have match"
我想使用apr-utils apr_strmatch 函数
pattern = apr_strmatch_precompile(pool, "([a-fA-F0-9]{32})", 0);
if (NULL != apr_strmatch(pattern, target, strlen(target)) {
printf("We have match!\n");
}
到 C:问题是我不明白 apr-utils apr_strmatch 函数正在使用正则表达式(或方言)的语法。搜索文档和示例最终没有结果。
感谢您提前的建议...
I want to port the following regex from python:
HASH_REGEX = re.compile("([a-fA-F0-9]{32})")
if HASH_REGEX.match(target):
print "We have match"
to C with apr-utils apr_strmatch function:
pattern = apr_strmatch_precompile(pool, "([a-fA-F0-9]{32})", 0);
if (NULL != apr_strmatch(pattern, target, strlen(target)) {
printf("We have match!\n");
}
The problem is that I don't understand what syntax of regex (or dialect) apr-utils apr_strmatch function is using. Search for documentation and examples ended with no results.
Thanks for your advices in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
apr_strmatch
根本不进行正则表达式匹配;它使用 Boyer–Moore–Horspool< 进行普通子字符串搜索/a> 算法(参见来源)。对于 C 中的 RE 匹配,请尝试 PCRE。
apr_strmatch
doesn't do regular expression matching at all; it does ordinary substring search using the Boyer–Moore–Horspool algorithm (see source).For RE matching in C, try PCRE.