Regular Expressions

<regex>

1,regex类,设置匹配模式pattern

2,regex_match,regex_search匹配字符串,返回bool类型表征是否匹配到

3,smatch类string,存储匹配的详细信息;cmatch类(const char*);wsmatch类(wstring),wcmatch(const wchar_t*)

match的结果的结构

1,m[0]匹配的match_results

2,prefix()和suffix()分别是匹配元素的前后部分

3,m[1],m[2],m[3]匹配到的元素的子元素

match_results<>类的定义

typedef match_results<string::const_iterator> smatch;

typedef match_results<wstring::const_iterator> wsmatch;

typedef match_results<const char*> cmatch;

typedef match_results<const wchar_t*> wcmatch;

sed:类似UNIX使用的命令语法
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容