例如:
<link rel="stylesheet" href="/images/style.css" />
<SCRIPT language=JavaScript type=text/JavaScript>
//改变图片大小
function resizepic(thispic)
{
if(thispic.width>400) thispic.width=400;
}
//无级缩放图片大小
function bbimg(o)
{
var zoom=parseInt(o.style.zoom, 10)||100;
zoom+=event.wheelDelta/12;
if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
</SCRIPT><script type="text/javascript">我想要匹配 <link rel="stylesheet" 到 o.style.zoom=zoom+'%'; 之间 包括这连个字符串的正则!大家帮我写下!
<link rel="stylesheet" href="/images/style.css" />
<SCRIPT language=JavaScript type=text/JavaScript>
//改变图片大小
function resizepic(thispic)
{
if(thispic.width>400) thispic.width=400;
}
//无级缩放图片大小
function bbimg(o)
{
var zoom=parseInt(o.style.zoom, 10)||100;
zoom+=event.wheelDelta/12;
if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
</SCRIPT><script type="text/javascript">我想要匹配 <link rel="stylesheet" 到 o.style.zoom=zoom+'%'; 之间 包括这连个字符串的正则!大家帮我写下!
<link rel="stylesheet" href="/images/style.css" /><SCRIPT language=JavaScript type=text/JavaScript>
//改变图片大小
function resizepic(thispic)
{
if(thispic.width>400) thispic.width=400;
}
//无级缩放图片大小
function bbimg(o)
{
var zoom=parseInt(o.style.zoom, 10)||100;
zoom+=event.wheelDelta/12;
if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
</SCRIPT><script type="text/javascript"> 删除线的那部分
Pattern p = Pattern.compile("(?s)<link rel=\"stylesheet\".+?\\bo\\.style\\.zoom=zoom\\+\'%\';");
testfile文件
例如:
<link rel="stylesheet" href="/images/style.css" />
<SCRIPT language=JavaScript type=text/JavaScript>
//改变图片大小
function resizepic(thispic)
{
if(thispic.width>400) thispic.width=400;
}
//无级缩放图片大小
function bbimg(o)
{
var zoom=parseInt(o.style.zoom, 10)||100;
zoom+=event.wheelDelta/12;
if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
</SCRIPT> <script type="text/javascript"> 我想要匹配 <link rel="stylesheet" 到 o.style.zoom=zoom+'%'; 之间 包括这连个字符串的正则! 大家帮我写下!
测试java代码:
package regexp;import java.io.File;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;import junit.framework.TestCase;import org.apache.commons.io.FileUtils;
/**该类的作用:
*
*/
public class TestRegExp extends TestCase{
private String srcStr ;
public void testMatch(){
String regStr = "<link rel=\"stylesheet\".*?o\\.style\\.zoom=zoom\\+'\\%';";
Pattern p = Pattern.compile(regStr, Pattern.DOTALL);
Matcher m = p.matcher(srcStr);
while(m.find()) {
System.out.println(m.group(0));
}
}
@Override
protected void setUp() throws Exception {
try {
srcStr = FileUtils.readFileToString(new File(this.getClass().getResource("testfile").getFile()));
} catch (IOException e) {
e.printStackTrace();
}
}
}