js|jscript| Function | regular
As a powerful tool for text substitution, search and extraction in pattern matching, the application of regular expression (Regular Expression) has been gradually infiltrated into network development from the UNIX platform, as the
In the previous articles we used the Python urllib module and did some work on the Web page. Now introduce a very powerful tool-the regular expression. In telling the regular, I refer to the book "Proficient in Regular expression (third edition)---Jeffrey E.f.friedl", althou
$ '; +--–+--–+ ——— +--+ ———— + ——-+ | name| owner | species | sex | birth | death | +--–+--–+ ——— +--+ ———— + ——-+ | Fluffy | Harold | Cat| f | 1993-02-04 | NULL | | Buffy | Harold | Dog| f | 1989-05-13 | NULL | +--–+--–+ ——— +--+ ———— + ——-+ to find the name containing a "W", use the following query: mysql> SELECT * from pet WHERE name REGEXP ' W '; + ———-+ ——-+ ——— +--+ ———— + ———— + | name| owner | species | sex | birth | death | + ———-+ ——-+ ——— +--+ ———— + ———— + | Claws | Gwen
As a powerful tool for text substitution, search and extraction in pattern matching, the application of regular expression (Regular Expression) has been gradually infiltrated into network development from the UNIX platform, as the server-side/client Script development langua
As a powerful tool for text substitution, search and extraction in pattern matching, the application of regular expression (Regular Expression) has been gradually infiltrated into network development from the UNIX platform, as the server-side/client Script development langua
"regular expression" object provided by VBScritp5.0, as long as your server has ie5.x installed, it will take VBScript5.0. In fact, the "regular expression" was originally a Unix patent, especially in the Perl language, the most widely used, it is because of the "
example, [z | j | q] indicates matching any letter in z, j, and q.Regular expression grouping (this part and the following are from Zhou Gong's blog :)Enclose a part of a regular expression with () to form a group, also known as a submatch or a capture group. For example, for a time in the format of "08:14:27", we can write the following
, can provide some equivalent to the HTML code features, but also avoid the forum to be malicious attacks, these custom tags are commonly known as UBB code." Today's trendy forums support UBB code, such as: http://www. Chinaasp. COM (Dynamic Technology Network) of the forum is very good support UBB code. Now, let's use the regular expression object together to implement our own colorful UBB code.
First of a
. REGEXP_REPLACE
The Code is as follows:
Copy code
Select REGEXP_REPLACE ('Joe Smith ',' () {2,} ',', ') AS RX_REPLACE FROM dual;Select REGEXP_REPLACE ('aa bb CC', '(. *)', '3, 2, 1') FROM dual;SQL> select * from test;ID MC--------------------------------------------------------------------------------A AAAAAA aaaaaB bbbbb
SQL> select * from test where regexp_like (id, 'B', 'I
Regular expressions are often used to validate various forms, Java forms register common Regular Expression validation tool classes, and common regular expression large collections.
1. Telephone number
2. zip Code
3. QQ
4. E-Mail
5. Mobile phone number
6. URL
7. Wheth
Let's take a look at the following example to resolve the following IP:192.160.1.234[PORT=8080,TYPE=FTP]The IP address, port number, and port type in the above expression are extracted.Before the regular expression, everyone looked at it, and the estimate collapsed. There is no way to use the string method to intercept the chant. So, we wrote the following code:S
. Parentheses, as a method of assigning precedence, are almost impossible to avoid using. But it's really surprising that many popular regular expressions have the ability to capture the parentheses--because most of the time I don't have to capture it, and this time it's just a waste of time and space to do something extra. So in my own regular expression engine,
operation is extremely low, there is no good solution? Yes, that's the "Regular expression" object provided by VBScritp5.0, as long as your server has ie5.x installed, it will bring VBScript5.0. In fact, the "regular expression" is originally a patent under Unix, especially
RegularExpressionValidator ControlUse the RegularExpressionValidator control, and of course you can validate it directly in the background without the RegularExpressionValidator controlThe ValidationExpression property has several default authentication methods, but that is far from enough . The ErrorMessage property is an error message.As shown in the picture, you can click the "..." pop-up window to select the regular
last number entered.
|
Delimiter, which is used to separate two expressions to match one of them correctly, for example, T | the match "The" or "".
Abbreviation match
Abbreviations
Match
\
Letters, numbers ([a-zA-Z0-9])
\ B
Space (blank): ([\ t])
\ C
Letter ([a-zA-Z])
\ D
Decimal number ([0-9])
\ H
Hexadecimal number ([0-9a-fA-F])
\ N
Line feed: (\ r | (\ r? \ N ))
\ Q
Reference
group matches the URL. Replace \ 1 in the expression with the name matched by the first group (for example, "blog"), and \ 2 with the URL matched by the second group (for example, "http://www.cnblogs.com /"), in this way, we get the expected result [1]. Example 2. Generate a form
Original text:
Username
Password userpassword
Regular Expression:
, using regular expressions to handle strings, like using SQL to process data. As we avoid using complex SQL when working with data, we should avoid using complex regular expressions when dealing with strings. Here is a section of code to determine the legality of an IP address, simpler than using
any malicious attacks on the forum.
Syntax rules and tags for regular expressions
Now we formally enter the expression of learning, I will be based on the example of a combination of regular expression of the use, after reading you will feel that writing UBB code so simple, as long as you follow me step-by-Step afte
Appendix G: MySQL Regular Expression
Regular Expressions are a powerful way to specify patterns for complex searches.
MySQL adopts the Regular Expression of Henry Spencer, and its goal is to comply with POSIX 1003.2. See Appendix C: Thank you. MySQL adopts an extended versi
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.