<table>
<tr>
<td style="width:180px">
<a href="/search?q=user:240698+[java]" class="post-tag" title="show all posts by this user in 'java'">java</a><span class="item-multiplier">× 176</span><br>
<a href="/search?q=user:240698+[servlets]" class="post-tag" title="show all posts by this user in 'servlets'">servlets</a><span class="item-multiplier">× 25</span><br>
<a href="/search?q=user:240698+[jsp]" class="post-tag" title="show all posts by this user in 'jsp'">jsp</a><span class="item-multiplier">× 11</span><br>
<a href="/search?q=user:240698+[core]" class="post-tag" title="show all posts by this user in 'core'">core</a><span class="item-multiplier">× 9</span><br>
</tr>
</table>
从上面的代码我只需要获取java,servlets,jsp和core。
有人可以帮助我在java中编写一个正则表达式来获取那些吗?
由于
答案 0 :(得分:2)
请don't使用正则表达式解析HTML,改为使用HTML parsers。
答案 1 :(得分:1)
如果我必须使用正则表达式,我会尝试
"/search\?q=user:\d+\+\[(\w*)\]"