The principle and introduction of regular expression, application (concept article)

Source: Internet
Author: User
Tags definition empty regular expression
Concept | The concept of regular minima
Definition: For any set S1 and S2, when S1∈S2 and s1∩s2= null (no empty this symbol, I use the Chinese word empty substitution), then called S1 as a minimum of S2.
OK said the definition, we say about the regular match, you can look for the string as a set S1, and to find a minimum, that is, a subset of
and the discrete regular theorem: Every not empty set, there is a minimum, clearly said, is the truth of the match, we are going to look for a subset, that is, the large string is divided, and its element is a small subset of strings
Mathematical expression of the regular axiom: A≠ (Presence x) (x∈a∧x∩a= null)

Now is the compiler principle, the compiler principle is based on the discrete content of the
The first is to say formal grammar and finite automata
Formal grammar (Chomsky Type 3 grammar)
Normal type (Regular Expression):
Definition: Set A is a non-empty finite alphabet, then:
1 arbitrary, empty, the complete collection are regular type
2 if α,β is regular, then Α|β,α β,α*,β* is also regular (about this is related to the problem of grammar, which is commonly used w+ and so on)
3) can only be obtained by using the 1,2 rule only for a limited time

Write a regular set of α=a+b+c+ that everyone is familiar with is L (Alpha), which can write
L (Alpha) ={abc,aabc,abc,abcc,aaabc ...} See here if you use the regular words, you can clearly see to contact
On the normal set of some of the mathematical aspects of the things I do not say, such as exchange rate, binding rate and so on
And for a long series of things, such as the use of or statements to carry out the operation of the equation set, but said
In fact, there is also a concept that when you use a while and so on when the statement is actually the bottom of the regular formula, and JS or VBS with the reason is slow because of the multiple is looking, is regular, you can look at the wood Fox a search for the best formula of the post, in multiple search after the speed of natural slow

Now write with VBS, simple examples


<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> New Page 3</title>
<script language= "VBScript" >
Str= "Ssuuiadseestiaosu"
Dim Regex,match
Set Regex=new REGEXP ' sets the regular object
Regex. Global = True ' sets the match globally
Regex. IgnoreCase = False ' setting is case-sensitive if false is case sensitive
Regex.pattern= "[A-z]" to set the matching content
Set Mm=regex.execute (str) ' Execute
For all match1 in mm ' view in array
document.write Match1
document.write ("<br>")
document.write Match1. FirstIndex
document.write ("<br>")
Next
</script>
<body>

</body>





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.