JavaScript Regular Expression Test Web page
How do you normally test regular expressions? Write directly in a large section of code, then wait for the program to run there, and then display the results with alert? Or do you write a page temporarily and throw it away after the test is done?
You can try my this page, although it is very rough, but the test regular expre
even have to take the initiative to avoid it, as long as you don't use the (pseudo) lambda expression to use it.
The new implementation code is as follows:
Copy Code code as follows:
/*!
L-amda "A-lambda", a module provides alternate "LAMBDA" style programming ability for JavaScript.
Created by Nanalich. 2010-09-10
This module is published under WTFPL v2 and so you just do WHAT the Fxxx to
addition to the regular array elements, the returned array also contains 2 object properties:The index declaration matches the starting character of the text in the position of the stringInput declares a reference to StringobjectGlobal Invocation of RegExp:If RegExp has the flag G, the match () method performs a global retrieval to find all matching substrings in the stringNo matching substrings were found, then NULL is returnedIf one or more matching substrings are found, an array is returnedT
Regular expressions have a lot of content, but this series mainly discusses the most common knowledge points. We all have this experience in our study: if too many knowledge points are discussed each time, it will not be easy to absorb and digest, nor will it be conducive to the formation of the Knowledge context, therefore, this series will divide limited content into several articles for discussion.
A regular expression is an object that describes t
A regular expression is used to implement the minimum matching function.
This example describes how to use a regular expression to implement the minimum matching function. We will share this with you for your reference. The details are as follows:
By default, regular expressions implement maximized matching, which is q
The regular expression replace () function:This function substitutes a specified string for a substring that matches a literal expression in a string.The return value is a new, replaced string.Only the relevant operations of the regular expression are described here, and the other substitution operations can refer to t
assigned with different values. Many attributes have both long and short (Perl style) names, and these two names point to the same value. (
Javascript simulates Regular Expressions in Perl)
Attributes of a regular expression object:Attribute meaning$1... $9 if it exists, it is a matched substring.$ _ See Input$ * See multiline$ See lastmatch$ + See lastparen$ 'See leftcontext$ ''See rightcontextConstru
Tag: Result lis Reference cancels space AAC func return expressionThis article describes the JavaScript regular expression catalogTo create a regular expressionRegular Expression FlagUsing regular expressions in stringsMethods of regular expressionsMetacharactersSpecial charactersGreedy modeGroup
To create a regular expressionvar="I love English";var=newRegEx
JavaScript has a lot of interesting uses and can be found in Google Code search, for example:Try to know that the meaning of this code is to declare a function, and then immediately execute, because the scope of variables in JavaScript is based on function, so this can avoid the variable pollution, but here the bitwise
is as follows:
The code is as follows
Copy Code
Example 2
The code is as follows
Copy Code
function Testdemo () {var r, re; Declare a variable.var s = "I";re =/i/ig; Creates a regular expression pattern.document.write (Re.test (s) + "document.write (Re.test (s) + "document.write (Re.test (s));}Testdemo ();Output results:TrueFalseTrue
A regular expression is a formula that uses a pattern to match a type of string, and the regular expression consists of some ordinary characters and some metacharacters (metacharacters). Ordinary characters include uppercase and lowercase letters and numbers, while metacharacters have special meanings, whether they are. NET platform or Java platform, the meaning of the
}) is not greedy. The non-Greedy mode matches as few searched strings as possible, while the default greedy mode matches as many searched strings as possible.
(? : Pattern) matches pattern but does not get the matching result. That is to say, this is a non-get match and is not stored for future use.
You can view the. Source attribute of the regular expression object by checking whether the regular expres
Regular Expressions in JavaScript:Let's start with a brief description of regular expressions in JavaScript. The ECMAScript v3 standardizes JavaScript Regular Expressions. JavaScript 1.2 implements a subset of the regular expressions required by the ECMAScript V3, and JavaScript 1.5 implements the complete standard. Ja
Put a code like this firstThe correct codevar foo= function() { // functions content };foo ();Everyone is familiar with this code, creating a function expression and executing it immediately. Next, we try to simplify the code to become an immediate execution function expression.The wrong codefunction() {
I recently learned javaScript and learned the regular expression. The knowledge is messy, so I wrote a blog to make a summary.DefinitionThere are two methods to define reg exp in javascript:1) Use new exp: var exp1 = new exp ("abc ");2) Put pattern: var exp2 =/abc/; // In the middle of the two directories .. Without Double quotation marks, the string is added.Spe
How to use JavaScript to implement a simple encapsulation function for arithmetic expression computation can help us record the computation process. Step 1: implement the createOperator function and return the closure function:
var Add = createOperator("+" ,
function
In JavaScript, a function is also a data type, and there are two ways to define a function:
function f () {return 1;}
var f=function () {return 1;}
So, the function in
Php regular expression processing function summary analysis. Preg_grep (PHP4, PHP5) preg_grep -- returns the array unit that matches the pattern. description: arraypreg_grep (stringpattern, arrayinput [, intflags]) preg_grep () returns an array, including inpu preg_grep
(PHP 4, PHP 5)
Preg_grep -- returns the array unit that matches the pattern.
Description
Array preg_grep (string pattern, array input [, i
(){...} ) () And (function (){...} () Is a common method of writing two types of javascript Functions for immediate execution;
Initially I thought it was an anonymous function wrapped in parentheses, and then added a bracket to call the function. Finally, the function was d
PHP regular expression function learning summary. What about PHP regular expression functions? So what exactly does the PHP regular expression function mean? What is the specific usage? Let's introduce you one by one. What are PHP regular
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.