Regexp,用于带有数字的特定单词
Regexp for a particular word with a digit
我似乎无法为以下内容找到正则表达式。。
即Earth
+任何数字。
例如
Earth1
Earth2
Earth3
Earth10
Earth20
...
我以为这应该行得通,但不行。。
std::regex("Earthd$")
首先,您必须添加一个斜线来转义当前斜线。第二-添加重复(+
),因为d
表示数字(而不是数字):
std::regex("Earth\d+$")
相关文章:
- 将数字转换为单词
- 使用if-else将数字转换为单词
- 如何使数组以单词而不是数字的形式出现
- 如何在函数中输入数字以输出单词?
- C++:如果用户输入数字将其转换为单词,并且如果按回车键程序应退出,则使用开关大小写
- 从文件的一行中查找数字的平均值,避免使用第一个单词
- 找到一些单词后如何解析数字
- C++:对单词而不是数字进行快速排序
- 分类包含数字和单词的字符串向量
- 从文本文件(c++)中读取单词和数字
- 读取数字并转换为单词
- 正则表达式使用数字作为标记拆分单词
- 使用C++计算字符串中字母数字单词数量的最有效方法
- 打印由用户定义的数组,第一个数字确定单词的大小,第二个数字确定行的大小
- 编写代码将给定的数字转换为单词(例如1234作为输入应输出一千二百三十四)
- Regexp,用于带有数字的特定单词
- 生成由字母和数字组成的随机单词
- C++将包含单词和数字的字符串转换为数字
- String Stream in C++ 解析单词和数字字符串
- 将 3 位数字转换为单词C++