c++ - 如何将有界重复匹配为仅 n 和 m 次

标签 c++ regex boost

基于 this

a{n}  Matches 'a' repeated exactly n times.

a{n,}  Matches 'a' repeated n or more times.

a{n, m}  Matches 'a' repeated between n and m times inclusive.

问题> 如何匹配 'a' 恰好重复了 n 次或 m 次? 谢谢

最佳答案

非常简单:a{n}|a{m} :)

好吗?

关于c++ - 如何将有界重复匹配为仅 n 和 m 次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8651966/

相关文章:

c++ - 共享库 (c/c++) 中的 pstack。损坏的共享库

C++ 使用 boost::ptr_vector 泄漏内存

c++ - boost 序列化 std::unique_ptr 支持

c++ - x64 进程在 4GB RAM 上可以占用多少内存

c++ - 运算符<和严格的弱排序

c++ - c++ ("cin"语句中的 I/O 异常问题)

javascript - jquery 正则表达式 trim url 字符串的开头和结尾

c# - 有人在 C# 应用程序中使用过 RE2 吗?

regex - awk 模式匹配和允许一个歧义/不匹配的解决方案

c++ - 为什么 boost::call_traits<T>::param_type 是枚举类型的引用?