您的位置:首页 > 其它

正则表达式 网页处理速度慢。。怎么优化?

2017-01-03 05:11 471 查看
不知道具体该怎么描述标题。。。:

问题背景:

id 业务内容

1  a...b....

2  b....c.....a....

3  c....d..

4  d....e....

输入a...b....能把所有涉及到的都提取出来。(实际是电话号码) 即以上4条应都取出来。

现在做的是再查找一次,实际上应该不停查找,直到没有再涉及为止,但个人能力太菜- -

现在主要问题就是速度太慢( ?是不是因为正则表达式?) 请各位指点

其他:

如果输入为空,response.end()会导致页面什么都不返回。。。咋回事0 0 迫不得已让shuru=11111111了。。。。

<%

function tiqu(str)

dim regex

dim mymatch,matches

set regex=new regexp

regex.MultiLine = True

regex.global=true

regex.pattern="\D[1,5]\d{10}\D|\D\d{8}\D|\D053\d{8}\D|\D\d{7}\D|\D053\d{9}\D"

set matches=regex.execute("a"& str &"a")

if matches.count<>0 then 

for each mymatch in matches

tiqu=tiqu&mid(mymatch,2,len(mymatch)-2)&"%' or 业务内容 like '%"

next

tiqu=left(tiqu,len(tiqu)-17)

else

tiqu=1111111111111

end if

end function

%>

</head>

<body>

<%

shuru=trim(request("shuru"))

if shuru="" then 

shuru=111111111111

else

shuru=tiqu(shuru)

end if

set conn=server.createobject("adodb.connection")

conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("tousu1.mdb")

exec="select * from 2010 where 业务内容 like '%"&shuru&"%' or 流水号 like '%"&shuru&"%' union all  select * from 201101 where 业务内容 like '%"&shuru&"%' or 流水号 like '%"&shuru&"%' union all select * from tousu where 业务内容 like '%"&shuru&"%' or 流水号 like '%"&shuru&"%' order by 流水号"

set rs=server.CreateObject("adodb.recordset")

rs.open exec,conn,1,1
do while not rs.eof

shuru=shuru & rs("业务内容")

rs.movenext

loop

shuru=tiqu(shuru)

rs.close

set rs=nothing

exec="select * from 2010 where 业务内容 like '%"&shuru&"%' or 流水号 like '%"&shuru&"%' union all  select * from 201101 where 业务内容 like '%"&shuru&"%' or 流水号 like '%"&shuru&"%' union all select * from tousu where 业务内容 like '%"&shuru&"%' or 流水号 like '%"&shuru&"%' order by 流水号"

set rs=server.CreateObject("adodb.recordset")

rs.open exec,conn,1,1

%>

<table width="49%" border="1" align="left" cellpadding="0" cellspacing="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">

<th colspan="2">投诉工单:<%=rs.RecordCount%></th>

<%do while not rs.eof%>

          <tr>

    <td><%=rs("流水号")%></td>

    <td><%=rs("业务内容")%></td>

      </tr>

<%

rs.movenext

loop

%>

<%

rs.close

set rs=nothing

%>

</table>

</td>

    <td width="50%"><table width="49%" border="0" align="right">

      <tr>

        <td>

  <div align="center"><span class="STYLE1"><a href="tousu.asp">返回主页</a></span>

      </div>

  <form id="form1" name="form1" method="get" action="chongfutousu.asp">

    <span class="STYLE1">请贴入需要查询的内容(整段投诉内容)</span><br />

        <textarea name="shuru" cols="60%" rows="8" id="shuru"></textarea>

        <input name="tijiao" type="submit" id="tijiao" value=" 提 交>>>" />

        </form></td>

      </tr>

      <tr>

        <th>投诉测试情况</th>

      </tr>

      <tr>

        <td><table width="100%" border="1" bordercolorlight="#000000" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF">

<%

exec="select * from ceshifankui where 用户联系方式 like '%"&replace(shuru,"业务内容","用户联系方式")&"%'"

set rs=server.CreateObject("adodb.recordset")

rs.open exec,conn,1,1

%>

 <%do while not rs.eof%>

          <tr>

    <td><%=rs("用户联系方式")%></td>

    <td><%=rs("测试时间")%> </td>

    <td><%=rs("投诉受理人")%> </td>

    <td><%=rs("实测位置")%> </td>

    <td><%=rs("处理结果")%> </td>

    <td><%=rs("是否签回执单")%> </td>

          </tr>

<%

rs.movenext

loop

%>

<%

rs.close

set rs=nothing

%>

        </table></td>

<tr>

        <td> </td>

      </tr>

      <tr>

        <th>手机伴侣</th>

      </tr>

      <tr>

        <td><table width="100%" border="1" bordercolorlight="#000000" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF">

            <%

exec="select * from shoujibanlv where 用户联系方式1 like '%"&replace(shuru,"业务内容","用户联系方式1")&"%'"

set rs=server.CreateObject("adodb.recordset")

rs.open exec,conn,1,1

%>

            <%do while not rs.eof%>

            <tr>

              <td><%=rs("用户联系方式1")%></td>

              <td><%=rs("测试时间1")%> </td>

              <td><%=rs("投诉受理人")%> </td>

              <td><%=rs("实测位置")%> </td>

              <td><%=rs("处理结果")%> </td>

              <td><%=rs("是否签回执单")%> </td>

            </tr>

            <%

rs.movenext

loop

%>

            <%

rs.close

set rs=nothing

%>

        </table></td>

      </tr>

      <tr>

        <td> </td>

      </tr>

      <tr>

        <th><div align="center"><strong>已派测试</strong></div></th>

      </tr>

      <tr>

        <td><table width="100%" border="1" bordercolorlight="#000000" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF">

<%

exec="select * from yipaiceshi where 联系方式 like '%"&replace(shuru,"业务内容","联系方式")&"%'"

set rs=server.CreateObject("adodb.recordset")

rs.open exec,conn,1,1

%>

 <%do while not rs.eof%>

          <tr>

    <td><%=rs("工单号")%> </td>

    <td><%=rs("安排测试时间")%> </td>

    <td><%=rs("联系方式")%></td>

    <td><%=rs("反映地点")%> </td>          </tr>

<%

rs.movenext

loop

%>

<%

rs.close

set rs=nothing

conn.close

set conn=nothing

%>

        </table></td>

      </tr>

      

    </table></td>

  </tr>

</table>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: