class MatchObject

This class is what is used to return match information from regular expression object

Description

This object is used to provide match information with regular expressions. They are returned from match(), in an array returned from matchAll(), and passed in as the parameters to the closures. It is important to note that when counting captures they start at 0, NOT 1 like backticks.

Example

object r = new Regexp('([A-Za-z]*) ([0-9]*)' );
object m = r.match( "Chris 42" );
Console.println( "Captures: ${m.captures()}" ); &raquo [ "Chris", "42" ]

class contents [NB. Highlighted attributes are static members]
Functions
function capture(number) - Get a specific capture from the match
function captures() - All of the captures within an array
function end() - The location in the original string where the match ends
function match() - The match this object represents
function span() - The start and end of the match returned in a two element array
function start() - The location in the original string where the match starts

Functions

function capture Click to go up to the list
Get a specific capture from the match
Declaration:
    function capture( number index )
Parameters:
    Parameter #1: number index - The index to get; the start index is 0
Returns:
    The captured string if the index exists or an empty string

function captures Click to go up to the list
All of the captures within an array
Declaration:
     function captures()
Returns:
    An array with strings as each element

function end Click to go up to the list
The location in the original string where the match ends
Declaration:
     function end()
Returns:
    An number containing the index

function match Click to go up to the list
The match this object represents
Declaration:
     function match()
Returns:
    A string containing the match value

function span Click to go up to the list
The start and end of the match returned in a two element array
Declaration:
     function span()
Returns:
    A two element array

function start Click to go up to the list
The location in the original string where the match starts
Declaration:
     function start()
Returns:
    An number containing the index

Automatically generated at 12:07PM, Wednesday 25 May 2005 by feritedoc.