ASP Regular expression filter content in the contact method

Source: Internet
Author: User
Tags regular expression

function Repnum (STRNG) ' returns as an array
i = 0
Set regex = new RegExp
Regex.pattern = "(d+)" "[0-9]"
Regex.ignorecase = True
Regex.global = True
Set matches = Regex.execute (strng)
For the match in matches
' Retstr = retstr & <br> ' & Match.value
If Len (match.value) >=5 Then
STRNG = replace (strng, right (match.value,4), "* *")
End If
i = i + 1
Next
Repnum = strng
End Function
Use the time directly <%=repnum (content)%> on the line, the result is the content string of some numbers are replaced by * * *, play a role in the hidden contact. If you think you left a lot of numbers, change the corresponding number within this function.


and add a related function.

Feature: ASP tutorial The regular expression extracts all the digits in a string.
Parameter: strng for content to extract
function regexptest (strng)   ' return with array
    i = 0
    Set Regex = new RegExp
    regex.pattern = "(d+)" ' [0-9] "
    regex.ignorecase = true     Regex.global = True
    Set matches = Regex.execute (strng)
  & nbsp For the match in matches
        retstr = retstr & "<br>" & Match.value ' output extracted from the number
        i = i + 1
    next
 & nbsp;  regexptest = Retstr
End Function
uses method <%=regexptest (content)%>, the run result is all the numbers in the content string, and wraps.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.