Data verification is very common in both C/S and B/S. In the past, we liked to use a bunch of if... else... determine whether the input content meets the requirements.
Many languages now support regular expressions, which define a set of their own
C # cainiao Regular Expression 1,
LZ cainiao, who only takes notes and takes notes, adds an impression.
LZ believes that there is no need to be too entangled in the principle, the model, the silk can be used on the right, the rest of the things will
This class provides regular validation functions that are often used in daily development. For example: Mailbox, phone number, phone number, identity card number, date, number, decimal, URL, IP address, etc. Using the matches method of the pattern
Xregex1_2: NowWithNamedCapture
Update:A beta version of XRegExp 0.3 is now available as part ofRegexPal download package.
JavaScript's regular expression flavor doesn't support named capture. Well, says who? XRegExp 0.2 brings named capture support,
This article introduces how to use RegExp objects in asp regular expressions. For more information, see this article.
RegExp objects support simple regular expressions.
RegExp object usage:
The Code is as follows:
Copy code
The following is a reference clip:-----/**//// /// Remove HTML tags/// /// including the source code of HTML /// removed text Public static string nohtml (string htmlstring){// Delete the scriptHtmlstring = RegEx. Replace (htmlstring, @ "
However, some cases only need to pass a few files, and the file volume is not too large, in this case, the use of components is a bit of a nut to kill chicken feeling, through the HTML form can realize the required functions, the key is the
Do not use page caching:
You can add the following code to the page Page_Load event that you do not want to be cached
Copy Code code as follows:
Response.Expires = 0;
Response.Buffer = true;
Response.ExpiresAbsolute =
Copy Code code as follows:
UBB code written by someone else
Using System;
Using System.Text;
Using System.Text.RegularExpressions;
Namespace test.com
{
Function: UBB Code
Author: rexsp
Date: 2004-4-6
public class UBB
{
#region
However, some cases only need to pass a few files, and the file volume is not too large, in this case, the use of components is a bit of a nut to kill chicken feeling, through the HTML form can realize the required functions, the key is the
The power of regular expressions cannot be underestimated. Just a few characters often outperform dozens of lines of code, greatly simplifying our redundant code.
In the past, many regular expressions were used in JS. Today, I am familiar with the
So far, many programming languages and tools have supported regular expressions, of course. NET is no exception ,. NET base class library contains a namespace and a series of classes that can fully exert the power of Rule expressions.
The knowledge
CopyCode The Code is as follows: // UBB code written by someone else
Using system;Using system. text;Using system. Text. regularexpressions;Namespace test. com{/// /// Function: UBB Code/// By rexsp/// Date: 2004-4-6/// Public class UBB{# Region
However, some cases only need to pass a few files, and the file volume is not too large, in this case the use of components is a bit sledgehammer to kill the chicken feeling, through the HTML comes with the
form can achieve the required functions,
1. Regular Expression: Use a string of characters to verify whether a regular expression complies with the regular expression.2. metacharacters commonly used in regular expressions:. Match any character except linefeed\ W matches letters, numbers,
UBB reference some articles, sorted out, we can use it directly, in fact, since the Freetextbox such dongdong appeared, UBB has gradually faded out of the lake.
Using System;
Using System.Text;
Using System.Text.RegularExpressions;
Namespace
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.