Regexp object
Attribute:
Global attributes:
Sets or returns a Boolean value that specifies whether the entire search string matches all or only the first one.
Ignorecase attributes:
Sets or returns a Boolean value to indicate whether the mode search is case sensitive.
Pattern attributes:
Set or return the regular expression pattern to be searched.
Method:
Perform regular expression search on the specified string.
Object. Execute (string)
Parameters:
Object: required. It is always the name of a Regexp object.
String: required. The text string on which the regular expression is to be executed.
Note:
The regular expression search design mode is set through the pattern of the Regexp object.
The execute method returns a matches set, which contains each matching match object found in the string. If no match is found, execute returns an empty matches set.
Replace the text found in the regular expression search.
Object. Replace (string1, string2)
Parameters:
Object: required. It is always the name of a Regexp object.
String1: required. String1 is the string to be replaced by text.
String2: required. String2 is a replacement text string.
Note:
The actual mode of the replaced text is set through the pattern attribute of the Regexp object.
The replace method returns a copy of string1, where the Regexp. Pattern text has been replaced with string2. If no matching text is found, the original copy of string1 is returned.
Perform a regular expression search on the specified string and return a Boolean value indicating whether the matching mode is found.
Object. Test (string)
Parameters:
Object: required. It is always the name of a Regexp object.
String: required. The text string to be searched by the regular expression.
Note:
The actual pattern of Regular Expression search is set through the pattern attribute of the Regexp object. The Regexp. Global attribute has no effect on the test method.
If the matching mode is found, the test method returns true; otherwise, false.