擅长:python、mysql、java
<p><a href="http://docs.python.org/library/re.html">regular expression objects</a>的<code>findall</code>方法可以一次获得它们:</p>
<pre><code>>>> import re
>>> s = "this #is a #string with several #hashtags"
>>> pat = re.compile(r"#(\w+)")
>>> pat.findall(s)
['is', 'string', 'hashtags']
>>>
</code></pre>