\d+ digits (0-9) (1 or more times (matching
the most amount possible))
x 'x'
\d+ digits (0-9) (1 or more times (matching
the most amount possible))
(?: group, but do not capture (optional
(matching the most amount possible)):
\. '.'
\d+ digits (0-9) (1 or more times (matching
the most amount possible))
)? end of grouping
\s* whitespace (\n, \r, \t, \f, and " ") (0 or
more times (matching the most amount
possible))
GHz 'GHz'
在更易于阅读的格式中
[0-9]
表示一位数字:返回:
使用
见regex proof
解释
如果需要,不区分大小写:
这个正则表达式模式可以帮助您:
([\d.]+)\s?[xX]\s?([\d.]+)\s?GHz
或insitive case(?i)([\d.]+)\s?x\s?([\d.]+)\s?GHz
请参见regex101中的示例
将其附加到Python源代码:
输出
解释
([\d.]+)\s?[xX]\s?([\d.]+)\s?GHz
([\d.]+)
匹配第一个实数李>\s?[xX]\s?
匹配x
、x
、x
、X
、X
、X
李>([\d.]+)
匹配第二个实数李>\s?
是可选的,匹配whitespace character
或不匹配李>GHz
匹配字面上的单词GHz李>相关问题 更多 >
编程相关推荐