Adobe InDesign CS5 (7.0) Object Model JS: RegExp

InDesign CS5

Class

RegExp

 Wraps a regular expression.

QuickLinks

RegExp, compile, exec, test, toString

Class

PropertyTypeAccessDescription
$1string readonlyThe matched subexpression #1.
$2string readonlyThe matched subexpression #2.
$3string readonlyThe matched subexpression #3.
$4string readonlyThe matched subexpression #4.
$5string readonlyThe matched subexpression #5.
$6string readonlyThe matched subexpression #6.
$7string readonlyThe matched subexpression #7.
$8string readonlyThe matched subexpression #8.
$9string readonlyThe matched subexpression #9.
globalbool r/wIndicates whether the match is a global match.
ignoreCasebool r/wIndicates whether the match is not case sensitive.
inputstring r/wThe original input string.
lastMatchstring readonlyThe last match.
lastParenstring readonlyThe value of the last matched subexpression.
leftContextstring readonlyThe string before the match.
multilinebool r/wIndicates whether the match matches multiple lines.
rightContextstring readonlyThe 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.

ParameterTypeDescription
patternstringThe pattern to convert.
flagsstringFlags 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.

ParameterTypeDescription
patternstringThe 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.

ParameterTypeDescription
textstringThe string to match.

bool test (text: string)
Execute a regular expression, and return true if there is a match.

ParameterTypeDescription
textstringThe string to match.

string toString ()
Converts this RegExp object to a string.

Used in:

Array String.match (regexp: RegExp)

number String.search (search: RegExp)

Return

RegExp RegExp.RegExp (pattern: string[, flags: string])

Jongware, 20-Jun-2010 v3.0.3dContents :: Index