<p>使用</p>
<pre class="lang-py prettyprint-override"><code>re.findall(r'\d+x\d+(?:\.\d+)?\s*GHz', procesor)
</code></pre>
<p>见<a href="https://regex101.com/r/9T7HOu/1/" rel="nofollow noreferrer">regex proof</a></p>
<p><strong>解释</strong></p>
<pre><code>
\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'
</code></pre>
<p>如果需要,不区分大小写:</p>
<pre class="lang-py prettyprint-override"><code>re.findall(r'\d+x\d+(?:\.\d+)?\s*GHz', procesor, re.I)
</code></pre>