Testing for Pattern Matches : Introduction « Regular Expressions « JavaScript Tutorial
- JavaScript Tutorial
- Regular Expressions
- Introduction
The pattern matching methods in the String object require RegExp objects.
Pattern Matching Methods in the String Object
Method | Description |
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. |