RegExp
QuickLinks
Class
Property | Type | Access | Description |
---|---|---|---|
$1 | string | readonly | The matched subexpression #1. |
$2 | string | readonly | The matched subexpression #2. |
$3 | string | readonly | The matched subexpression #3. |
$4 | string | readonly | The matched subexpression #4. |
$5 | string | readonly | The matched subexpression #5. |
$6 | string | readonly | The matched subexpression #6. |
$7 | string | readonly | The matched subexpression #7. |
$8 | string | readonly | The matched subexpression #8. |
$9 | string | readonly | The matched subexpression #9. |
global | bool | r/w | Indicates whether the match is a global match. |
ignoreCase | bool | r/w | Indicates whether the match is not case sensitive. |
input | string | r/w | The original input string. |
lastMatch | string | readonly | The last match. |
lastParen | string | readonly | The value of the last matched subexpression. |
leftContext | string | readonly | The string before the match. |
multiline | bool | r/w | Indicates whether the match matches multiple lines. |
rightContext | string | readonly | The string after the match. |
Methods
Constructor
RegExp RegExp (pattern:
string[, flags:
string])
Creates and returns a new RegExp object set to the value of the argument converted to a regular expression.
Parameter | Type | Description |
---|---|---|
pattern | string | The pattern to convert. |
flags | string | Flags that control how the conversion is performed. A string containing any combination of the letters i, m, g: • "i" -- ignore case in pattern matching • "m" -- treat the string as multiple lines • "g" -- do global pattern matching (Optional) |
Instances
bool compile (pattern:
string)
Compiles a string to a regular expression. Returns true if the compilation was successful.
Parameter | Type | Description |
---|---|---|
pattern | string | The pattern to compile. |
Array exec (text:
string)
Execute a regular expression.
The return value is an array of matches, with the first element containing the match, and successive elements containing the results of any matching subexpression in their order of appearance. If there is no match, the result is null.
Parameter | Type | Description |
---|---|---|
text | string | The string to match. |
bool test (text:
string)
Execute a regular expression, and return true if there is a match.
Parameter | Type | Description |
---|---|---|
text | string | The string to match. |
Used in:
Array String.match (regexp: RegExp)
number String.search (search: RegExp)
Return
RegExp RegExp.RegExp (pattern: string[, flags: string])
Jongware, 28-Apr-2012 v3.0.3i | Contents :: Index |