How to use XSL and regular expressions to verify the validity of data (i)

Source: Internet
Author: User
Tags regular expression xsl
Series 17: How to use XSL and regular expressions to verify the validity of data
XSL is now gradually becoming a similar and SQL in XML in the database design position.
Although Microsoft's XSL is simply a function of some of these parts
But you've been able to implement very complex queries.
Although today's XSL is just a form of pure text and string
The query Language
In the example described below, a search that uses a large number of strings in the text,
You will find that a large part of the processing of data in XML is to use the query in the text.
This is a very popular feature in the writing of XSL.
Because of this, you should understand how some regular expressions should be used.
A brief introduction to regular expressions
Regular expressions are mostly from the needs of the UNIX world.
In Unix, many programming languages are almost entirely centered around regular expressions (Perl, Python, TCL, for example).
But it's strange that regular expressions seem to have been used recently in the Windows family,
Especially in scripting languages, such as JavaScript and VBScript,
Although you can also use them in Visual Basic or Java, it is clear that they appear to be
More appealing in scripting languages. Perhaps for this reason, it seems that people rarely use regular expressions.
Using regular expressions, you can create a matching template based on what you want to query (English is called pattern).
Once you have used a regular expression to create a template, you can use it to test your string.
Use it to accomplish a number of functions:
For example, to determine whether a string is in another string (or where in another string)
For example, use a string to replace another string
For example, returns a list of all strings that meet template criteria
For example... Wait, wait.
I've covered the basic concepts of regular expressions, with detailed descriptions and syntax for MSDN and
The Help in JavaScript.
In VB, if you want to refer to regular expressions, you need to refer to "Microsoft VBScript Regular Expressions" in your project. But if you use a script you don't have to, because in the script it's already a
The inner object is for you to quote.
Of course you need to install IE4 on your machine.
This object (in JavaScript) is called RegExp
Here's the code to illustrate the problem, now suppose you want to see if a text block contains a specific
Strings (for example, "regular Expressions")
Code See below:
The code is written using VB.
Public Function istermindocument (FilePath as String,_
Expr as String) as Boolean

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.