Enter strings for regular cleaning

Source: Internet
Author: User

 

1 ' ----------------------------------------------------
2 '
3 ' Regular cleaning of input strings.
4 '
5 ' Remove characters not in [a-zA-Z0-9 _]
6 ' Delete words script | JavaScript | VBScript | JScript
7 '
8 '
9 ' ----------------------------------------------------
10 Public   Shared   Function cleanstringregex () Function Cleanstringregex ( Byval Inputtext As   String ) As   String
11 Dim Options As Regexoptions = Regexoptions. ignorecase
12 Return Replaceregex (inputtext, " [^ \\\.!? "" ', \-\ W \ s @] " , Options)
13 End Function   ' Cleanstringregex
14
15 ' ----------------------------------------------------------
16 ' Removes Design Characters from input strings using regular expressions
17 ' RegEx (regularexpression, options) uses the modify mode option to initialize and compile the RegEx class instance for the specified regular expression.
18 ' ----------------------------------------------------
19
20 Private   Shared   Function replaceregex () Function Replaceregex ( Byval Inputtext As   String , Byval Regularexpression As   String , Byval Options As Regexoptions) As   String
21 Dim RegEx As   New RegEx (regularexpression, options)
22 Return RegEx. Replace (inputtext, "" )
23 End Function   ' Replaceregex

'

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.