擅长:python、mysql、java
<p>不需要regexp,请参见<a href="http://docs.python.org/library/stdtypes.html#str.count" rel="nofollow noreferrer">^{<cd1>}</a>:</p>
<blockquote>
<p><code>str.count(sub[, start[, end]])</code></p>
<p>Return the number of non-overlapping occurrences of substring sub in the range [start, end]. Optional arguments start and end are interpreted as in slice notation.</p>
</blockquote>
<pre><code>>>> "A.B.C.D".count(".")
3
>>> "A/B.C/D".count(".")
1
>>> "A/B.C/D".count(".") == 1
True
>>>
</code></pre>