<P><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体"><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600">
<IMG
src="/uploadfiles/2010/02/20/142520343/765017.jpg/765017.jpg"
border=0><v:stroke joinstyle="miter">
</v:stroke><v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path>
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
<o:lock aspectratio="t" v:ext="edit">
</o:lock></v:shapetype></SPAN></P>把红色部分截取出来
<IMG
src="/uploadfiles/2010/02/20/142520343/765017.jpg/765017.jpg"
border=0><v:stroke joinstyle="miter">
</v:stroke><v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path>
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
<o:lock aspectratio="t" v:ext="edit">
</o:lock></v:shapetype></SPAN></P>把红色部分截取出来
int index2 = String(你那段代码).indexof(".jpg");String(红色部分) s = String(你那段代码).substring(indexof - 4, indexof + 12);
var imgEle = shareEle.childNodes(1);
alert(imgEle.outerHTML);
indexOf+substring就是说明了一个思路,如果楼主用过这两个函数,一看便知,何况还有3楼的示例代码。
用indexOf获取
<IMG src="/uploadfiles/2010/02/20/142520343/765017.jpg/765017.jpg" border=0>
中src=""里面内容的起始坐标,再用substring把他截出来,就是楼主要的内容啊。
1.txt里边是存的你要的那些东西
BufferedReader in = new BufferedReader(new FileReader("c:\\1.txt")); String s, s2 = new String();
while ((s = in.readLine())!= null )
s2=s2+ s + "\n" ;
in.close();
Pattern pattern = Pattern.compile("<IMG[//s]?.*>");
Matcher matcher = pattern.matcher(s2);
if(matcher.find()){
System.out.println(matcher.group());
}else{
System.out.println("nothing");
}
结果是:<IMG src="/uploadfiles/2010/02/20/142520343/765017.jpg/765017.jpg" border=0>