regex - 使用正则表达式在字符串中查找 0-360
问题描述
我想写一个正则表达式,它可以提取字符串中 0 到 360 之间的数字。以下是示例:
Text: "Rotate by 360 degrees"
OP: 360
Text: "36 degrees degree rotation"
OP: 36
Text: "rotate 100"
OP: 100
Text: "rotate 6700"
OP: NA (as 6700 is out of range)
我想通过正则表达式来实现
解决方案
列举可能性:
\b([0-2]?[0-9]{1,2}|3[0-5][0-9]|360)\b
推荐阅读
- python - 有没有办法使用用户输入来调用函数?
- swift - 未使用正确的值观察到已发布的 var
- excel - 如何使用 VBA 自动调整列宽?
- r - ggplot:geom_text 不在 geom_col 上方打印
- owl - 如何比较OWL中的属性?
- excel - Excel使用求和函数并删除求和数
- mysql - 使用 sidecar 方法将我的 kubernetes 引擎应用程序连接到谷歌云 sql 实例时遇到问题
- python - Pyautogui 函数 locateonscreen 给出属性错误
- java - LWJGL glGenVertexArrays() 正在阻止执行
- r - 将函数应用于随机行的 dplyr'ish 版本