微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

RE2 C++正则表达式引擎

程序名称:RE2

授权协议: BSD

操作系统: 跨平台

开发语言: C/C++

RE2 介绍

RE2 是一个快速、安全和线程友好的C++正则表达式引擎。

例子:

// copyright 2008 The RE2 Authors.  All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#include<re2/re2.h>
#include<re2/filtered_re2.h>
#includeusing namespace re2;

int main(void) {
FilteredRE2 f;
int id;
f.Add("a.*b.*c", RE2::DefaultOptions, &id);
vectorv;
f.Compile(&v);
vectorids;
f.FirstMatch("abbccc", ids);

if(RE2::FullMatch("axbyc", "a.*b.*c")) {
printf("PASS\n");
return 0;
}
printf("FAIL\n");
return 2;
}

RE2 官网

https://github.com/google/re2

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐