|
Console Library 8.0.0
A header-only library that makes C++ simple
|
提供正则表达式匹配、搜索、替换、分割等操作,接口类似 Python 的 re 模块。 More...
Go to the source code of this file.
Classes | |
| class | console::BasicRegex< CharT, Traits > |
| 正则表达式对象,封装编译后的模式,提供匹配、搜索、替换等功能。 More... | |
| class | console::BasicRegex< CharT, Traits >::Match |
| 匹配结果对象,保存文本副本和位置信息,不依赖迭代器有效性。 More... | |
| struct | console::BasicRegex< CharT, Traits >::Match::GroupInfo |
Namespaces | |
| namespace | console |
| 本库所有组件所在的顶层命名空间。 | |
| namespace | console::re |
Typedefs | |
| using | console::Regex = BasicRegex<char> |
| 字符正则表达式。 | |
| using | console::WRegex = BasicRegex<wchar_t> |
| 宽字符正则表达式。 | |
Functions | |
| Regex | console::re::compile (const std::string &pattern, std::regex::flag_type flags=std::regex::ECMAScript) |
| 编译字符串模式为正则表达式。 | |
| WRegex | console::re::compile (const std::wstring &pattern, std::wregex::flag_type flags=std::wregex::ECMAScript) |
| 编译字符串模式为宽字符正则表达式。 | |
| Regex::Match | console::re::search (const std::string &pattern, const std::string &text) |
| 在文本中搜索正则表达式的第一个匹配项。 | |
| WRegex::Match | console::re::search (const std::wstring &pattern, const std::wstring &text) |
| 在文本中搜索正则表达式的第一个匹配项。 | |
| Regex::Match | console::re::match (const std::string &pattern, const std::string &text) |
| 在文本中匹配正则表达式的第一个匹配项。 | |
| WRegex::Match | console::re::match (const std::wstring &pattern, const std::wstring &text) |
| 在文本中匹配正则表达式的第一个匹配项。 | |
| std::vector< std::string > | console::re::findall (const std::string &pattern, const std::string &text) |
| 在文本中查找所有匹配正则表达式的子串。 | |
| std::vector< std::wstring > | console::re::findall (const std::wstring &pattern, const std::wstring &text) |
| 在文本中查找所有匹配正则表达式的子串。 | |
| std::vector< std::string > | console::re::split (const std::string &pattern, const std::string &text, int maxsplit=0) |
| 在文本中按正则表达式模式分割字符串。 | |
| std::vector< std::wstring > | console::re::split (const std::wstring &pattern, const std::wstring &text, int maxsplit=0) |
| 在文本中按正则表达式模式分割字符串。 | |
| std::string | console::re::sub (const std::string &pattern, const std::string &repl, const std::string &text, int count=0) |
| 在文本中替换正则表达式匹配的子串。 | |
| std::wstring | console::re::sub (const std::wstring &pattern, const std::wstring &repl, const std::wstring &text, int count=0) |
| 在文本中替换正则表达式匹配的子串。 | |
| std::string | console::re::escape (const std::string &s) |
| 转义正则表达式中的特殊字符。 | |
| std::wstring | console::re::escape (const std::wstring &s) |
| 转义正则表达式中的特殊字符。 | |
提供正则表达式匹配、搜索、替换、分割等操作,接口类似 Python 的 re 模块。
封装了 C++ 标准库的 std::basic_regex,提供更便捷的面向对象和函数式接口。