Category:Regular Expression

  • Remove HTML from content


    <%Option Explicit Function stripHTML(strtext)dim arysplit,i,j, strOutputarysplit=split(strtext,”<“)   if len(arysplit(0))>0 then j=1 else j=0   for i=j to ubound(arysplit)     if instr(arysplit(i),”>”) then       arysplit(i)=mid(arysplit(i),instr(arysplit(i),”>”)+1)     else       arysplit(i)=”<” & arysplit(i)     end if  next   strOutput = join(arysplit, “”)  strOutput = mid(strOutput, 2-j)  strOutput = replace(strOutput,”>”,”>”)  strOutput = replace(strOutput,”<“,”<“)   stripHTML = strOutputEnd Function %> <form method=”post” id=form1 name=form1>  <b>Enter an HTML String:</b><br>  <textarea name=”txtHTML” cols=”50″ […]

  • Code for converting text to hyperlink and email format


    If the user enters http://aaa.bbb.cccThe following code will convert his input into http://aaa.bbb.cccLet’s see how powerful regular expressions are, ha ha. <%‘call this function to display as a hyperjoin    Response.Write to_html(s_message)%> <%Function to_html(s_string)    to_html = Replace(s_string, “”””, “””)    to_html = Replace(to_html, “<“, “<“)    to_html = Replace(to_html, “>”, “>”)    to_html = […]

  • Regular expression (I)


    Regular expression is regular expression. It seems that English is much better than Chinese in understanding. It is to check the expression symbolNot in accordance with the regulations!! Regular expressions have a very powerful and complex object, regexp, in JavaScript 1 Version 2 inAvailable on.Let’s take a look at the introduction of regular expressions:Regular expression […]

  • Regular expression (II)


    Regular expression specification (II) The following are not new objects of regular expressions. Please refer to the properties of the corresponding JavaScript object$_ Attribute reference input $* attributeReference multiline $& attribute reference lastmatch $+ attribute reference lastparen $` attributeReference leftcontext $’attribute reference rightcontext compile method compile regular expression object during script runningMethods belonging to regexp […]

  • 17 regular expressions


    “^ \ D + $” / / non negative integer (positive integer + 0)“^ [0-9] * [1-9] [0-9] * $” / / positive integer“^ (- \ D +)| (0 +) $” / / non positive integer (negative integer + 0)“^ – [0-9] * [1-9] [0-9] * $” / / negative integer“^ -? \ D + […]

  • Regular expression exerciser


    Copy codeThe code is as follows: <HTML><HEAD>< title > regular expression exerciser < / Title >< meta name = Anhui Chizhou Bureau of statistics Xu zuning e-mail: [email protected] ><script language=”JavaScript”>function OnMove() {window.status = “(“+window.event.clientX+”,”+window.event.clientY+”)” + ” :: “+document.location}</script> <SCRIPT LANGUAGE=”JavaScript1.2″>Var re = new regexp() / / create regular expression objectVar nextpoint = 0 / / […]

  • Ubbcode is simple and practical


    <%function ChkBadWords(fString)    if not(isnull(BadWords) or isnull(fString)) then    bwords = split(BadWords, “|”)    for i = 0 to ubound(bwords)        fString = Replace(fString, bwords(i), string(len(bwords(i)),”*”))     next    ChkBadWords = fString    end ifend function function HTMLEncode(fString)if not isnull(fString) then    ‘fString = Replace(fString, CHR(38), “&”)    ‘fString = replace(fString, “>”, “&gt;”)    ‘fString = replace(fString, “<“, “&lt;”)    ‘fString = Replace(fString, CHR(39), “'”)    […]

  • In ASP, regular expression objects are used to verify the legitimacy of data


    When we make websites, especially various e-commerce websites, we will first let users fill in some forms to obtain various information of registered users, because users may input all kinds of information, and some unqualified data will bring unnecessary trouble to our back-end ASP processing program, and even lead to some security problems in the […]

  • Truncate string to remove HTML tags


    <%‘**************************************************‘function name: gottopic‘function: cut string, Chinese characters count as two characters, and English count as one character‘parameter: STR — original string‘strlen — intercept length‘return value: intercepted string‘**************************************************function gotTopic(str,strlen)if str=”” thengotTopic=””exit functionend ifdim l,t,c, istr=replace(replace(replace(replace(str,” “,” “),”””,chr(34)),”>”,”>”),”<“,”<“)str=replace(str,”?”,””)l=len(str)t=0for i=1 to lc=Abs(Asc(Mid(str,i,1)))if c>255 thent=t+2elset=t+1end ifif t>=strlen thengotTopic=left(str,i) & “…”exit forelsegotTopic=strend ifnextgotTopic=replace(replace(replace(replace(gotTopic,” “,” “),chr(34),”””),”>”,”>”),”<“,”<“)end function‘=========================================================‘function: removehtml (strhtml)‘function: remove HTML […]

  • Learning website


  • Convert UBB code to HTML


    I remember posting a code that converts UBB code into HTML format before. I read the source code of UBB a few days ago. So with this new version. Note that this version may not work properly. See note for details. This code converts the UBB code entered by the user into HTML format. Note […]

  • JavaScript regular expression test web page


    How do you test regular expressions? Write it directly in a large piece of code, then wait for the program to run there, and then display the results with alert? Or write a page temporarily and throw it away after the test? You can try my page. Although it’s rough, it’s enough to test regular […]