擅长:python、mysql、java
<p>regex中有两个问题:</p>
<ol>
<li>你的表达式是<a href="http://www.regular-expressions.info/anchors.html" rel="noreferrer">anchored</a>by <code>^</code>和<code>$</code>,它们分别是“行的开始”和“行的结束”锚。这意味着您的模式希望匹配整行文本。</li>
<li>您正在标点符号前面搜索<code>\s+</code>,标点符号指定<a href="http://www.regular-expressions.info/repeat.html" rel="noreferrer">one or more</a><a href="http://www.regular-expressions.info/charclass.html#shorthand" rel="noreferrer">whitespace character</a>。如果标点符号前没有空格,则表达式将不匹配。</li>
</ol>