RegExp
QuickLinks
Properties
| 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
RegExp RegExp (pattern: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. |
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.
| 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
String.match (regexp:RegExp)
String.search (search:RegExp)
Return
RegExp RegExp.RegExp (pattern:string)