例如:
<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+'%'; 之间 包括这连个字符串的正则!大家帮我写下! 

解决方案 »

  1.   

    <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"> 删除线的那部分
      

  2.   


    Pattern p = Pattern.compile("(?s)<link rel=\"stylesheet\".+?\\bo\\.style\\.zoom=zoom\\+\'%\';");
      

  3.   

    我不是高手。需求不太明确,具体问题可能涉及更多问题。测试如下
    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();
    }
    }
    }
      

  4.   

    <link rel=\"stylesheet\".*?o\\.style\\.zoom=zoom\\+'\\%';这行代码 在UltraEdit 不起作用啊 哥给写个Perl版本的吧