Category: Collections-Text
Superclass: Object
I hold the results of a regular expression match, and I can reconstruct which parts of the matched string were assigned to each subexpression. Methods such as #=~ return RegexResults objects, while others transform the string directly without passing the results object back to the caller.

Method category index

accessing (instance)
testing (instance)

accessing (instance)

asArray
If the regular expression was matched, return an Array with the subexpressions that were present in the regular expression.

at: anIndex

If the regular expression was matched, return the text of the anIndex-th subexpression in the successful match.

from

If the regular expression was matched, return the index of the first character in the successful match.

fromAt: anIndex

If the regular expression was matched, return the index of the first character of the anIndex-th subexpression in the successful match.

intervalAt: anIndex

If the regular expression was matched, return an Interval for the range of indices in the anIndex-th subexpression of the successful match.

match

If the regular expression was matched, return the text of the successful match.

matchInterval

If the regular expression was matched, return an Interval for the range of indices of the successful match.

size

If the regular expression was matched, return the number of subexpressions that were present in the regular expression.

subject

If the regular expression was matched, return the text that was matched against it.

to

If the regular expression was matched, return the index of the last character in the successful match.

toAt: anIndex

If the regular expression was matched, return the index of the last character of the anIndex-th subexpression in the successful match.

top


testing (instance)

ifMatched: oneArgBlock
If the regular expression was matched, pass the receiver to oneArgBlock and return its result. Otherwise, return nil.

ifMatched: oneArgBlock ifNotMatched: zeroArgBlock

If the regular expression was matched, evaluate oneArgBlock with the receiver as the argument. If it was not, evaluate zeroArgBlock. Answer the result of the block's evaluation.

ifNotMatched: zeroArgBlock

If the regular expression was matched, return the receiver. If it was not, evaluate zeroArgBlock and return its result.

ifNotMatched: zeroArgBlock ifMatched: oneArgBlock

If the regular expression was matched, evaluate oneArgBlock with the receiver as the argument. If it was not, evaluate zeroArgBlock. Answer the result of the block's evaluation.

matched

Answer whether the regular expression was matched

top