REGULAR EXPRESSION in VBSCRIPT

Source: Internet
Author: User
Express|vbscript|express|vbscript

REGULAR EXPRESSION in VBSCRIPT
Object REGEXP is used to create and execute regular expression

Ex.
Code:
strtarget= "Test testing tested attest late Start"
Set objregexp= New RegExp ' Create a regular expression

objregexp.pattern= "test*" ' Set the search pattern
Objregexp.ignorecase=false ' Set the case sensitivity
Objregexp.global=true ' Set the scope

Set Colmatches=objregexp.execute (strtarget) ' Execute ' Search

For each Match in Colmathes ' Iterate the Colmatches collection
Response.Write "Match found at position" & Match.firstindex & "."
Response.Write "Matched value is '" & Match.value & "',<br>"
Next

Tested Result:
Match found at position 0. Matched value is ' test '.
Match found at position 5. Matched value is ' test '.
Match found at position 13. Matched value is ' test '.
Match found at position 22. Matched value is ' test '.



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.