How to Use XSL and regular expressions to verify data validity (1)

Source: Internet
Author: User
Tags xsl

Series 17: How to Use XSL and regular expressions to verify data Validity
XSL is gradually becoming a role in XML similar to SQL in database design.
Although Microsoft's XSL only implements some of the functions
However, you can implement very complex queries.
Although the current XSL is only a pure text and string-based method
Query Language
In the example described below, we will use a lot of string searches in the text,
You will find that a large part of data processing in XML must be queried in text.
This is a very popular feature in the compilation of XSL.
Because of this, you should know how to use some regular expressions.
Introduction to Regular Expressions
Most regular expressions come from the Unix world.
In Unix, almost all programming languages are centered around regular expressions (such as Perl, Python, and Tcl)
However, it is strange that regular expressions seem to have recently been used in the Windows series,
In particular, a large number of scripts, such as JavaScript and VBScript,
Although you can also use them in Visual Basic or Java, it seems that they are
Scripting languages are more attractive. For this reason, it seems that regular expressions are rarely used.
Using Regular Expressions, you can create a matching template (pattern) based on the content you want to query)
Once you create a template using a regular expression, you can use it to test your string,
Using it can accomplish many functions:
For example, to determine whether a string is in another string (or where it is in another string)
For example, replace another string with a string.
For example, return the list of all strings meeting the template conditions.
For example... And so on.
I have introduced the basic concepts of regular expressions. For details about the Regular Expression and Its syntax, refer to MSDN and
Help in JavaScript.
If you want to reference a Regular expression in VB, You need to reference "Microsoft VBScript Regular Expressions" in the project ". However, if you use a script, it is unnecessary because it is already
The internal object is for your reference.
Of course, you need to install IE4 or above on your machine.
This object (in JavaScript) is called RegExp
Let the Code explain the problem. Now, suppose you want to check whether a document contains a specific
String (for example, "regular expressions ")
For the code, see:
The code is written in 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.