关于java的正则表达式有关问题


关于java的正则表达式问题
有个字符串如下:

class="tag-item">成都地铁打人女</a$amp;>amp;$nbsp;</li$amp;>amp;$nbsp;    <li 0 $amp;>amp;$nbsp; </li$amp;>amp;$nbsp;    <li 0 $amp;>amp;$nbsp;<a data-nsclick="p=index&eventtype=hotquery.click&hotquery=%E6%B1%9F%E8%8B%8F%E5%A4%A9%E4%B8%8A%E4%BA%BA%E9%97%B4" target="blank" /i fr=hotindex&tn=baiduimage&ct=201326592&lm=-1&cl=2&nc=1&ie=utf-8&word=%E6%B1%9F%E8%8B%8F%E5%B8%B8%E7%86%9F%E5%A4%A9%E4%B8%8A%E4%BA%BA%E9%97%B4" class="tag-item">江苏天上人间</a$amp;>amp;$nbsp;</li$amp;>amp;$nbsp;    <li 0 $amp;>amp;$nbsp; </li$amp;>amp;$nbsp;    <li 1 class="hot"$amp;>amp;$nbsp;<a data-nsclick="p=index&eventtype=hotquery.click&hotquery=%E9%83%AD%E7%BE%8E%E7%BE%8E%E6%B3%B3%E8%A3%85%E7%85%A7" target="blank" /i fr=hotindex&tn=baiduimage&ct=201326592&lm=-1&cl=2&nc=1&ie=utf-8&word=%E9%83%AD%E7%BE%8E%E7%BE%8E%E5%86%8D%E6%99%92%E6%B3%B3%E8%A3%85%E7%85%A7" class="tag-item"$amp;>amp;$lt;/a$amp;>amp;$nbsp;</li$amp;>amp;$nbsp;


我想用从里面抽取出来“成都地铁打人女”,“江苏天上人间”,“郭美美泳装照”这三个关键词,该如何在java中实现?

java 程序开发 Java基础知识

木亥弓单亻吏 12 years, 10 months ago

还是这个看着舒服点。。

  public static void main(String[] arg) {
List<String$amp;>amp;$nbsp;imgList = new ArrayList<String>();
String intputStr = "class=\"tag-item\">成都地铁打人女</a$amp;>amp;$nbsp;</li$amp;>amp;$nbsp; " +
"   <li 0 $amp;>amp;$nbsp; </li$amp;>amp;$nbsp;    <li 0 $amp;>amp;$nbsp;" +
"<a data-nsclick=\"p=index&eventtype=hotquery.click&hotquery=%E6%B1%9F%E8%8B%8F%E5%A4%A9%E4%B8%8A%E4%BA%BA%E9%97%B4\" target=\"blank\" href=\"/i fr=hotindex&tn=baiduimage&ct=201326592&lm=-1&cl=2&nc=1&ie=utf-8&word=%E6%B1%9F%E8%8B%8F%E5%B8%B8%E7%86%9F%E5%A4%A9%E4%B8%8A%E4%BA%BA%E9%97%B4\"" +
" class=\"tag-item\">江苏天上人间</a$amp;>amp;$nbsp;</li$amp;>amp;$nbsp;    <li 0 $amp;>amp;$nbsp; </li$amp;>amp;$nbsp;    <li 1 class=\"hot\"$amp;>quot;$ +
" <a data-nsclick=\"p=index&eventtype=hotquery.click&hotquery=%E9%83%AD%E7%BE%8E%E7%BE%8E%E6%B3%B3%E8%A3%85%E7%85%A7\" target=\"blank\" " +

万恶的多属性控 answered 12 years, 10 months ago

( <=class="tag-item">)[^$amp;<amp>
</amp>

nsczxx answered 12 years, 10 months ago

Your Answer