Application of Regular Expressions in network programming (2)

Source: Internet
Author: User

Regular expression syntax rules and tags
Now we are going to officially start learning regular expressions. I will explain the usage of regular expressions based on examples. After reading this, you will feel that writing UBB code is so easy, as long as you follow me step by step to read this article, you will become a master of UBB. The exciting thing is that you can write your own UBB tag, and you no longer need to copy the ready-made code and templates from someone else.
Fortunately, VBScritp5.0 provides us with a "Regular Expression" object. As long as your server has IE5.x installed, you can run it.
Character Description:
^ Matches the start of a string. For example:
^ Abc matches "abc xyz" instead of "xyz abc"
$ Symbol matches the end of a string. For example:
Abc $ matches "xyz abc" instead of "abc xyz.
NOTE: If both the ^ and $ symbols are used, exact match is performed. For example:
^ Abc $ only matches "abc"
* The symbol matches 0 or more characters before it. For example:
AB * can match "AB", "abb", "abbb", etc.
+ The symbol matches at least one character before it. For example:
AB + can match "abb", "abbb", but does not match "AB ".
? The symbol matches 0 or 1 character. For example:
AB? C? Only "abc", "abbc", "abcc", and "abbcc" can be matched"
The. symbol matches any character except the line break. For example:
(.) + Match all strings except line breaks
X | y matches "x" or "y ". For example:
Abc | xyz can match "abc" or "xyz", while "AB (c | x) yz" matches "abcyz" and "abxyz"
{N} matches exactly the characters before n times (n is a non-negative integer. For example:
A {2} can match "aa", but does not match ""
{N,} matches the characters before at least n times (n is a non-negative integer. For example:
A {3,} matches "aaa", "aaaa", but does not match "a" and "aa ".
Note: a {1,} is equivalent to a +
A {0,} is equivalent to *
{M, n} matches at least m characters, and at most n characters are prefixed. For example:
A {1, 3} Only matches "a", "aa", and "aaa ".
Note: a {0, 1} is equivalent to?
[Xyz] indicates a character set that matches one of the characters in brackets. For example:

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.