RegExp()
syntax: |
new RegExp([pattern[, attributes]]) |
where: |
pattern - a string containing a regular expression pattern to use with this RegExp object.
attributes - a string with the attributes for this RegExp object.
|
return: |
object - a new regular expression object, or null on error.
|
description: |
Creates a new regular expression object using the search pattern and options if they are specified.
If the attributes string is passed, it must contain one or more of the following characters or be an empty string "":
i - sets the ignoreCase property to true g - sets the global property to true m - set the multiline property to true
|
see: |
Regular expression syntax, String match(), String replace(), String search()
|
example: |
// no options var regobj = new RegExp( "r*t", "" ); // ignore case var regobj = new RegExp( "r*t", "i" ); // global search var regobj = new RegExp( "r*t", "g" ); // set both to be true var regobj = new RegExp( "r*t", "ig" ); |