擅长:python、mysql、java
<p>您可以使用:</p>
<pre><code>re.search('^[^.]*\.?[^.]*$', 'this.is') != None
>>> re.search('^[^.]*\.?[^.]*$', 'thisis') != None
True
>>> re.search('^[^.]*\.?[^.]*$', 'this.is') != None
True
>>> re.search('^[^.]*\.?[^.]*$', 'this..is') != None
False
</code></pre>
<p>(匹配周期0或1次。)</p>