Skip to main content


Showing posts from November, 2013

javaScript RegExp Object

Syntax var patt=new RegExp(pattern,modifiers);

or more simply:

var patt=/pattern/modifiers; pattern specifies the pattern of an expressionmodifiers specify if a search should be global, case-sensitive, etc. Modifiers Modifiers are used to perform case-insensitive and global searches: ModifierDescriptioniPerform case-insensitive matchinggPerform a global match (find all
 matches rather than stopping after the first match)mPerform multiline matching
Example 1 Do a case-insensitive search for "w3schools" in a string: var str="Visit W3Schools";
var patt1=/w3schools/i; The marked text below shows where the expression gets a match: Visit W3Schools var pattern = new RegExp("[*?'\"&\\\\]"); pattern.test(abc.value)