Tag:asp

  • The Ajax usage of jQuery is implemented in ASP using $. Ajax()

    Time:2021-10-21

    Copy codeThe code is as follows: <% response.Expires=-1 response.CacheControl=”no-cache” %> <!–#include file=”../../conn/conn.asp“–> <!–#include file=”../psw.asp”–> <!–#include file=”../../functions/dofunction.asp”–> <!–#include file=”../../functions/showfunction.asp”–> <!–#include file=”../../fqdb/admin/website.asp”–> <% cmd = checkstr(request(“cmd”),2) if cmd=”loadteacher” then response.Charset = “gb2312” set rs=server.CreateObject(“adodb.recordset”) sql=”select teacher_id,name from Edu_Person” rs.open sql,conn,1,3 response.write “{“”data””:[” i = 0 do until rs.eof i = i + 1 response.write “{“”Id””:”&rs(“teacher_id”)&”,””Name””:”””&rs(“name”)&”””}” if i<rs.recordcount […]

  • ASP regular expression detects functions beginning with HTTP

    Time:2021-10-17

    ‘#################################### ‘function: ishttp [STR]‘parameter: STR, string to be processed‘author: Mu Mu‘date: July 12, 2007‘description: check whether the HTTP connection address or address bar starts with HTTP‘example: <% = ishttp( http://www.alixixi.com )%>‘#################################### Function ishttp(str) Dim regEx Set regEx = New RegExp regEx.Pattern = “^(http|HTTP)[A-Za-z]{0,1}\:\/\/” ishttp = regEx.Test(str) End functionVerify that the email address meets the standards<% ‘****************************** ‘function: isEmail (strng)‘parameter: strng, email address to be verified‘author: alisisi‘date: […]

  • Replacing non empty regular numbers in ASP

    Time:2021-10-4

    function replacestr(str) dim re set re=new regexp re.ignorecase=true re.global=true re.pattern=”\D” str=re.replace(str,””) replacestr=str set re=nothing end function

  • Regular expressions commonly used in ASP to replace strings

    Time:2021-10-1

    Remove HTML tag regular < \ / * [^ < >] * >Function LoseHtml(ContentStr)     Dim ClsTempLoseStr,RegEx         ClsTempLoseStr = Cstr(ContentStr)     Set RegEx = New RegExp         RegEx.Pattern = “<\/*[^<>]*>”         RegEx.IgnoreCase = True         RegEx.Global = True     ClsTempLoseStr = RegEx.Replace(ClsTempLoseStr,””)     Set RegEx = Nothing     LoseHtml = ClsTempLoseStr End function Remove class from web pageFunction LoseClassTag(ContentStr)     Dim ClsTempLoseStr,RegEx         ClsTempLoseStr = Cstr(ContentStr)     Set RegEx = New RegExp         RegEx.Pattern = “(class=){1,}(“”|\’){0,1}\S+(“”|\’|>|\s){0,1}”         RegEx.IgnoreCase = True         RegEx.Global = True     ClsTempLoseStr = RegEx.Replace(ClsTempLoseStr,””)     LoseClassTag = ClsTempLoseStr     Set RegEx = Nothing End Function Function LoseScriptTag(ContentStr)     Dim ClsTempLoseStr,RegEx         ClsTempLoseStr = Cstr(ContentStr)     Set RegEx = New RegExp         RegEx.Pattern = “(<script){1,}[^<>]*>[^\0]*(<\/script>){1,}”         RegEx.IgnoreCase = True         RegEx.Global = True     ClsTempLoseStr = RegEx.Replace(ClsTempLoseStr,””)     LoseScriptTag = ClsTempLoseStr     Set RegEx = Nothing End Function Function LoseIFrameTag(ContentStr)     Dim ClsTempLoseStr,RegEx         ClsTempLoseStr = Cstr(ContentStr)     Set RegEx = New RegExp         RegEx.Pattern = “(<iframe){1,}[^<>]*>[^\0]*(<\/iframe>){1,}”         RegEx.IgnoreCase = True […]

  • ASP regular expression matches the number $$

    Time:2021-9-25

         Copy codeThe code is as follows: Dim strOk,strNo      strOk = “12312321$12312312312$12312321$”      strNo = “12312321$12312312312$12312321$sdfsd”      Function RegExpTest(patrn, strng)           Dim   regEx,   match,   matches    ‘  Create variables.           Set   regEx  =  New   RegExp    ‘  Create a canonical expression.           regEx.Pattern  =  patrn    ‘  Set the mode.           regEx.IgnoreCase  =  True    ‘  Sets whether letters are case sensitive.           […]

  • Regularization of removing HTML tags and spaces by ASP

    Time:2021-9-24

    function nohtml(str)  dim re  Set re=new RegExp         re.IgnoreCase =true         re.Global=True         re.Pattern=”(\<.[^\<]*\>)”         str=re.replace(str,” “)         re.Pattern=”(\<\/[^\<]*\>)”         str=re.replace(str,” “)         str=replace(str,”&nbsp;”,””)        str=replace(str,” “,””)        nohtml=str         set re=nothing  end function

  • ASP + regular gets the last letter in the string. Non letters do not count

    Time:2021-9-14

      Copy codeThe code is as follows: Function getLastWord(str) Set regEx = New RegExp regEx.Pattern = “(.*)([a-zA-Z])[^a-zA-Z]*” regEx.IgnoreCase = false regEx.Global = True str = regEx.Replace(str,”$2″) getLastWord = str Set reg=nothing End Function str=”1B2A3fdsafdsf32432432″ Response.Write(getLastWord(str)):Response.End()

  • ASP regular filter duplicate string code

    Time:2021-9-10

    such as   1223445677777778aabbcccccccccc   After filtering, it is 12345678abc Copy codeThe code is as follows: <%     ‘filter duplicates    Function norepeat(Str)     Dim RegEx     If IsNull(Str) Or Str=”” Then Exit Function    Set RegEx=New RegExp         RegEx.Global = True        RegEx.IgnoreCase=True        RegEx.MultiLine = True        RegEx.pattern=”(.)\1+”        str=regEx.replace(str,”$1″)         Set RegEx=Nothing    Norepeat=str     End Function    ‘example     s=”1223445677777778aabbcccccccccc”    response.write Norepeat(s)     %> 

  • ASP regular function replaces the parameters after paging

    Time:2021-9-6

    Function DRexPage(Str)     Dim RegEx     If IsNull(Str) Or Str=”” Then Exit Function    Set RegEx=New RegExp         RegEx.IgnoreCase=True        RegEx.pattern=”(\&)?page=(\d)+”        DRexPage=regEx.replace(Str,””)  ‘(Str,”$1″)         Set RegEx=Nothing    End Function    Throw away everything behind the page that is used in the paging system

  • ASP match regular function uses matches instance

    Time:2021-9-5

       explain       Match     Objects can only pass through     RegExp     Object     Execute     Method, which actually returns     Match     A collection of objects. be-all     Match     Object properties are read-only.       When a regular expression is executed, it may produce zero or more     Match     Object. each     […]

  • ASP image regular replacement, check whether the image is a local address before replacement

    Time:2021-9-4

    Directly replace with regular, but there is no judgment functionFunction FormatImg(content) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern=”(script)” Content=re.Replace(Content,”script”) re.Pattern=”<img.[^>]*src(=| )(.[^>]*)>” Content=re.replace(Content,”<img   src=$2   style=””cursor:   pointer””   ALT = “” open browse in new window “”   onclick=””javascript:window.open(this.src);””   onload=””javascript:resizepic(this)””   border=””0″”/>”)set re = nothing FormatImg = content End Function This code replaces the picture in the content with  < img   src=$2 […]

  • ASP only collects the regular information of the visible text of the website

    Time:2021-8-31

     I wrote this:Function ClearHTMLCode(originCode) Dim reg set reg = new RegExp reg.IgnoreCase = True reg.Global = True reg.Pattern = “(<s+cript(.+?)<\/s+cript>)” originCode= reg.Replace(originCode, “”) reg.Pattern = “(<s+tyle(.+?)<\/s+tyle>)” originCode= reg.Replace(originCode, “”) reg.Pattern = “<[^>]*>” originCode= reg.Replace(originCode, “”) ClearHTMLCode = originCode End Function But some can’t be filtered! And it’s too slow!