Read about javascript regular expression tutorial, The latest news, videos, and discussion topics about javascript regular expression tutorial from alibabacloud.com
Javascript: Use a regular expression in javascript to verify whether the Email address format is correct.
1 // check whether email has been registered2 function CheckExists ()3 {4 var e = document. getElementById ("mailaddress"). value;5 if (e! = ""){6 if (! /(\ S) + [@] {1} (\ S) + [.] {1} (\ w) +/. test (e ))7 {8 ale
This article is the official HTML5 training course for h5edu institutions, mainly introduces: JavaScript intensive Tutorial--Regular expression backtrackingThe following example shows the process of processing a regular expression
result.After completing this tutorial, you can not only fully understand the above regular style, but also create more complex regular style.In the JS console, you can directly call the Str.match method to test the regular1 alert ("lala". Match (/la/))Here we will make the demo shorter and use the handy showmatch function to output the correct matching result:1
Special Charactersin regular style, some characters have special usage: [ \ ^ $ . | ? * + ( ).They are special because they are used to enhance the regular matching function. Don't try to memorize them, and when we've all used them, you can easily remember them.to use a special character as an ordinary identity, you must escape it . In other words, you need to precede the backslash.For example, we want to f
modifierA regular may contain a modifier that can affect search results.There are 3 modifiers in JS:g: Find all results;I: result ignoring case;m: Multi-line matching mode;Modifier is placed after the parameter, such as:/.../g.A regular with no global modifier returns only the first matching value:1 alert ("123". Match (/\d/)) // ' 1 'If there is a global modifier, all matching values will be returned:1 a
a problem with writing, all of them have problems. why don't you choose to read the regular expression on your own?[0-9]And\dIt is completely equivalent. why do we need to split it[0-9]\d{8}, Directly write\d{9}No.
Therefore, the regular expression is changed/^1[3|5|7|8]\d{9}$/Right!(The one at the beginning of your c
Let's take a look at the problem with this javascript regular expression? I put this code in my own page for testing. when the user name is 1234567890sss, the loop test is conducted. the account format can sometimes pass, sometimes fail, and the two situations are also alternating, I don't know where my program is wrong? JScriptcodeif (! ([W-.] +) @ ([0-9] {1, 3
PHP regular expression full tutorial basics, regular expression full tutorial
At present, regular expressions have been widely used in many software applications, including * nix (Linux
JavaScript's RegExp objects and string objects define methods that use regular expressions to perform powerful pattern matching and text retrieval and substitution functions.
In JavaScript, regular expressions are represented by a RegExp object. Of course, you can use a regexp () constructor to create RegExp objects, or you can use
Detailed explanation of matching a single character in the regular expression tutorial, detailed explanation of the Regular Expression
This document describes how to match a single character in the regular
Regular Expression of niuyun javascript (II), javascript Regular Expression
Next to the basic javascript Knowledge mentioned in the previous article, let's talk about the content of
-9a-za-z_]
\w: Matches any non-word character, [^0-9a-za-z_]
\s: Matches any whitespace character, space, carriage return, tab
\s: Matches any non-whitespace character
. Means: matches any single character
In addition, there are the following types:
Range characters: [A-z], [A-z], [0-9], [0-9a-z], [0-9a-za-z]Any character: [ABCD], [1234]Characters not included: [^a-z], [^0-9], [^ABCD]
4. Locator
^ Expression: opening identificati
negative character "[^]" stipulates that the string specified in the pattern cannot exist in the target object. For example:/[^a-c]/the above string will match any character except A,b, and C in the target object. Generally, when "^" appears inside "[]", it is regarded as a negation operator, and when "^" is outside "[]" or there is no "[]", it should be treated as a locator character.
Finally, the escape character "\" is used when the user needs to add metacharacters to the pattern of
PHP regular expression full tutorial to improve the article, regular expression full tutorial
In the previous article, I shared with you the basics of the php Regular
Regular Expression tutorial-subexpression Usage Analysis, regular expression
This document describes how to use a subexpression in the regular expression
Discussion on JavaScript regular expression group matching and javascript Regular Expression
Syntax
Metacharacters (pattern): used for group matching repeatedly
Attribute $1 ~ $9 if it exists, it is used to obtain the matched s
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.