{"id":46,"date":"2007-08-21T16:21:59","date_gmt":"2007-08-21T08:21:59","guid":{"rendered":"http:\/\/www.cnmiss.cn\/?p=45"},"modified":"2010-12-02T06:31:46","modified_gmt":"2010-12-02T06:31:46","slug":"%e5%ae%9e%e7%8e%b0%e6%90%9c%e7%b4%a2%e7%bb%93%e6%9e%9c%e7%9a%84%e5%85%b3%e9%94%ae%e8%af%8d%e5%8f%98%e8%89%b2%e6%a0%87%e6%b3%a8%e7%9a%84%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/www.cnmiss.cn\/?p=46","title":{"rendered":"\u5b9e\u73b0\u641c\u7d22\u7ed3\u679c\u7684\u5173\u952e\u8bcd\u53d8\u8272\u6807\u6ce8\u7684\u7a0b\u5e8f"},"content":{"rendered":"<blockquote><p>&lt;%<br \/>\u3000\u3000dim patern<br \/>\u3000\u3000dim found<br \/>\u3000\u3000<br \/>\u3000\u3000dim str<br \/>\u3000\u3000dim result<br \/>\u3000\u3000<br \/>\u3000\u3000patern=&quot;(a)|(b)&quot;<br \/>\u3000\u3000str=&quot; A dog fall in love with a cat. Can you believe?&quot;<br \/>\u3000\u3000result=&quot;&quot;\u3000\u3000<br \/>\u3000\u3000call getMatchText(str,result,false)<br \/>\u3000\u3000Response.Write result<\/p>\n<p>\u3000\u3000sub getMatchText(byref str,byref result,isNeedTrunc)<br \/>\u3000\u3000\u3000\u3000&#39;on error resume next<br \/>\u3000\u3000\u3000\u3000Dim regEx, Match, Matches<br \/>\u3000\u3000\u3000\u3000dim tStr<br \/>\u3000\u3000\u3000\u3000Set regEx = New RegExp\u3000\u3000\u3000\u3000 &#39; \u5efa\u7acb\u6b63\u5219\u8868\u8fbe\u5f0f\u3002\u3000\u3000\u3000\u3000<br \/>\u3000\u3000\u3000\u3000regEx.Pattern = (patern)\u3000\u3000&#39; \u8bbe\u7f6e\u6a21\u5f0f\u3002<br \/>\u3000\u3000\u3000\u3000regEx.IgnoreCase = True\u3000\u3000\u3000\u3000 &#39; \u8bbe\u7f6e\u662f\u5426\u533a\u5206\u5b57\u7b26\u5927\u5c0f\u5199\u3002<br \/>\u3000\u3000\u3000\u3000regEx.Global = True\u3000\u3000\u3000\u3000 &#39; \u8bbe\u7f6e\u5168\u5c40\u53ef\u7528\u6027\u3002<br \/>\u3000\u3000\u3000\u3000Set Matches = regEx.Execute(str)\u3000 &#39; \u6267\u884c\u641c\u7d22\u3002\u3000\u3000<br \/>\u3000\u3000\u3000\u3000if err.number&lt;&gt;0 then<br \/>\u3000\u3000\u3000\u3000\u3000\u3000response.write &quot;\u9519\u8bef1\uff1a&quot; &#038; err.description<br \/>\u3000\u3000\u3000\u3000\u3000\u3000err.clear<br \/>\u3000\u3000\u3000\u3000\u3000\u3000exit sub<br \/>\u3000\u3000\u3000\u3000end if<br \/>\u3000\u3000\u3000\u3000if matches.count &lt;&gt;0 then<br \/>\u3000\u3000\u3000\u3000\u3000\u3000dim startIndex\u3000\u3000\u3000\u3000\u3000\u3000<br \/>\u3000\u3000\u3000\u3000\u3000\u3000dim myMatchValue<br \/>\u3000\u3000\u3000\u3000\u3000\u3000startIndex=1<br \/>\u3000\u3000\u3000\u3000\u3000\u3000for each match in matches<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000if (instr(str,match.value)&gt;0) then<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000if instr(str,match.value)-50 &gt;0 then <br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000startIndex=instr(str,match.value)-50<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000else<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000startIndex=1<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000end if<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000myMatchValue=match.value<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000exit for<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000end if<br \/>\u3000\u3000\u3000\u3000\u3000\u3000next<br \/>\u3000\u3000\u3000\u3000\u3000\u3000if isNeedTrunc then<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000result= (mid(str,startIndex,strLength(myMatchValue)+100))<br \/>\u3000\u3000\u3000\u3000\u3000\u3000else<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000result= (str)\u3000\u3000<br \/>\u3000\u3000\u3000\u3000\u3000\u3000end if<br \/>\u3000\u3000\u3000\u3000\u3000\u3000for each match in matches<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000if not(instr(result,&quot;&lt;font color=red&gt;&quot; &#038; match.value &#038; &quot;&lt;\/font&gt;&quot;)&gt;0) then<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000result=replace(result,match.value,&quot;&lt;font color=red&gt;&quot; &#038; match.value &#038; &quot;&lt;\/font&gt;&quot; )<br \/>\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000end if<br \/>\u3000\u3000\u3000\u3000\u3000\u3000next<br \/>\u3000\u3000\u3000\u3000\u3000\u3000found=true<br \/>\u3000\u3000\u3000\u3000else<br \/>\u3000\u3000\u3000\u3000\u3000\u3000found=false <br \/>\u3000\u3000\u3000\u3000end if\u3000\u3000<br \/>\u3000\u3000\u3000\u3000set regEx=nothing<br \/>\u3000\u3000end sub<br \/>%&gt; <\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>&lt;%\u3000\u3000dim patern\u3000\u3000dim found\u3000\u3000\u3000\u3000dim str\u3000 &hellip; <a href=\"https:\/\/www.cnmiss.cn\/?p=46\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[13],"class_list":["post-46","post","type-post","status-publish","format-standard","hentry","category-xxbj","tag-asp"],"_links":{"self":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/posts\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=46"}],"version-history":[{"count":0,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/posts\/46\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}