A regular expression is an object that describes the character pattern.JavaScript's RegExp objects and string objects define methods that use regular expressions to perform powerful pattern-matching and text-retrieval and substitution functions.‘‘***
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
Using "Regular Expression" objects in ASP to implement UBB-style forums
Paste language: Inadvertently found in the Chinese network of this article, said that this site forum UBB style of the realization of the principle, so posted out and share with
Last time, we talked about how to use the "regular expression" object in ASP to achieve a variety of data validation, the text describes the powerful function of regular expression objects, and then,
Let's take a look at the other features of the
Regular Expressions:
We have been exposed to some concepts related to regular expressions. For example, in the Windows operating system, use the "? "and" * "wildcard to find files on hard disk,"? " Wildcards match a single character in the file
The regular expression object contains a regular expression pattern ). It has the properties and methods that use the regular expression mode to match or replace a string with a specific character (or character set combination ). To add attributes
. Net regular expressions and JavaScript Regular Expressions are a little different. Javascript uses the Perl syntax while. net uses the C # syntax, which must be distinguished by 2.1.
In JavaScript, regular expressions are represented by a Regexp
To use a regular expression to obtain any characters in a text segment, write the following matching rules:(.*)After the result is run, the text after the line break cannot be obtained. So I checked the manual and found that in the regular
In brief, regular expressions are a powerful tool for pattern matching and replacement. The function is as follows: test a mode of a string. For example, you can test an input string to see if there is a phone number or a credit card number. This is
Length property: str.length;Common methods:1. Str.charat (n)Finds the nth character in a string, or returns an empty string if it is not between 0~str.length-12. Str.indexof (Substr[,start])Returns the position of the first occurrence of the substr
Regular expression is regular expression, it seems that English is better than Chinese understand more, is to check expression characters
Not meet the rules!! Regular expressions have a very powerful and very complex object regexp, in the JavaScript1
When an expression is checked, a literal symbol provides a way to edit the regular expression. You can use a literal symbol to keep the regular expression constant. For example, if you use a literal symbol to construct a regular expression in a loop,
Brief introduction
In short, regular expressions are a powerful tool that can be used for pattern matching and substitution. Its role is as follows:
Tests a pattern of a string. For example, you can test an input string to see if there is a phone
The checksum is all made up of numbers
Copy Code code as follows:
function IsDigit (s)
{
var patrn=/^[0-9]{1,20}$/;
if (!patrn.exec (s)) return false
return True
}
Verify Login Name: Can only enter 5-20 letters
This article describes how to replace the content in a string with a regular expression in JavaScript, and provides a brief comment for ease of understanding. It has a certain reference value. If you need a friend, you can read more. Please refer to
In simple terms, regular expressions are a powerful tool for pattern matching and replacement. The function is as follows: test a mode of a string. For example, you can test an input string to see if there is a phone number or a credit card number.
Source reference from: MSDN http://msdn.microsoft.com/zh-cn/library/hs600312
How regular expressions work
Regular Expression example
Related Topics
The Regular Expression Language element provides information about the character set, operator, and
Analyze the influence of lastIndex on regular expression results,
Preface
Today, a problem occurs. When you use a regular expression to check the same string, true and false are returned alternately. In desperation, I flipped through the
Python Regular Expression learning. python regular expressions are common computer languages and are widely used. The following article describes how to use python Regular Expressions for complex string analysis, you just need to extract the desired
String
A string is one or more characters that are arranged together in single or double quotes.
' ABC '"ABC"
Length Property
The string in JS is similar to an array, and is made up of a single character, so you can use the Length property to
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.