如题,
加入一段内容为:喔喔喔喔<img str="http://www.baidu.com/img/123.jpg">我我我
我要把<img str="http://www.baidu.com/img/123.jpg">用正则表达式找出来,请问该如何写
加入一段内容为:喔喔喔喔<img str="http://www.baidu.com/img/123.jpg">我我我
我要把<img str="http://www.baidu.com/img/123.jpg">用正则表达式找出来,请问该如何写
Pattern p = Pattern.compile("<img str=\"\\S+\">", Pattern.DOTALL);// 创建 Matcher 对象
Matcher m = p.matcher("your string");// 是否找到匹配
boolean found = m.find();if( found )
{
String foundstring = m.group();
int beginPos = m.start();
int endPos = m.end();
}