Testing for Pattern Matches : Introduction « Regular Expressions « JavaScript Tutorial






The pattern matching methods in the String object require RegExp objects.

Pattern Matching Methods in the String Object

MethodDescription
match(regExpObj)Searches for regExpObj pattern in string and returns result.
replace(reqExpObj,str)Replaces all occurrences of the regExpObj pattern with str.
search(reqExpObj)Returns the position of matching regExpObj pattern within the string.
split(regExpObj,max)Splits string everywhere there is a matching regExpObj pattern up to max splits. The substrings are returned in an array.










26.1.Introduction
26.1.1.Pattern Matching
26.1.2.Defining Patterns
26.1.3.All the characters that require a backslash character to be taken literally within a pattern.
26.1.4.Pattern Attributes
26.1.5.Testing for Pattern Matches
26.1.6.The pattern matching methods in the RegExp object require String objects.