Inheritance diagram for RegExp:
Properties (DAZ Script 2 Extensions) | |
Array | capturedTexts |
Boolean | empty |
Number | matchedLength |
Boolean | valid |
Properties (ECMAScript) | |
Boolean | global |
Boolean | ignoreCase |
Number | lastIndex |
Boolean | multiline |
String | source |
Methods (DAZ Script 2 Extensions) | |
String | cap (Number which) |
Boolean | exactMatch (String text) |
Number | pos (Number which) |
Number | search (String text) |
Number | searchRev (String text) |
Methods (ECMAScript) | |
Array | exec (String string) |
Boolean | test (String string) |
String | toString () |
Constructors | |
RegExp (String expression) |
This is the DAZ Script counterpart of the QRegExp type used in the DAZ Studio SDK.
A RegExp object is a regular expression. Regular expressions are patterns used to perform searches in, or replace text in, strings.
Regular expressions can be created in DAZ Script directly, or via the constructor. The following example shows creating expressions via the two methods, both of which result in identical expressions.
Recommended Reading:
var regexp1 = /([A-Z]+)=(\d+)/; var regexp2 = new RegExp( "([A-Z]+)=(\\d+)" );
RegExp::RegExp | ( | String | expression | ) |
Default constructor.
expression | - The string representing the expression syntax. |
expression
must be escaped with an additional backslash.
which | The index of the capture to return |
text | - The String to search with the expression pattern. |
text
exactly matches this expression's pattern, otherwise false. Performs a regular expression match on the given string.
which | The index of the capture to return |
text | - The String to search with the expression pattern. |
text
, starting at the beginning of text
. If no match is made -1
is returned.
text | - The String to search with the expression pattern. |
text
, starting at the end of text
. If no match is made -1
is returned. Performs a regular expression match on the given string.
String RegExp::toString | ( | ) |
Provides an array of all the captured strings from the previous match. undefined if there was no match. (Read Only)
True if the expression is empty, otherwise false. (Read Only)
Used to indicate that the RegExp should be matched globally. A global RegExp will match every occurrence (as many times as possible), whereas a non-global RegExp will match only once at most (the first match it encounters). This is particularly relevant for String::replace() where every occurrence of a pattern will be replaced when global is true.
Read Only. Used to indicate that the RegExp ignores case when matching. This is true when the pattern flags contain the character "i".
The string position at which to start the next match.
Holds the length of the last matched string. -1 if there was no match. (Read Only)
Read Only. Used to indicate that the RegExp matches across multiple lines. This is true when the pattern flags contain the character "m".
A string value representing the pattern source.
True if the expression is syntactically valid, otherwise false. (Read Only)