# Io Reference

Parsers / Regex / RegexMatches

|  | A regular expression match iterator.

all

Returns a list containing all matches in the string.
allowEmptyMatches

Tells the receiver to allow zero length matches. Empty matches are allowed by default. Returns self.
allowsEmptyMatches

Returns true if the receiver allows empty matches, false if not.
anchored

Like `next`, but will only match at the current search position.
disallowEmptyMatches

Tells the receiver not to allow zero length matches. Returns self.
endPosition

Returns the index in the string where the receiver stops searching.
foreach(value, message)

Loops through the matches, assigns each match to value, and evaluates message. Returns the result of the last evaluation.
foreachInterval(value, matchMessage, nonMatchMessage)

Like `foreach`, but takes an extra message that will be evaluated for the non-matching text before each match, and the non-matching text after the last match.
last

Returns the last match in the string.
map(value, message)

Like `foreach`, but the result of each evaluation of message is returned in a list.
next

Returns the next match, or nil if there is none.
position

Returns the search position as an index in the string.
regex

Returns the Regex that the receiver uses for finding matching.
replace(name, message)

Replaces each match in the string with the result of message and returns the resulting string.
replaceAllWith(templateString)

Same as:

    	replace(match, match expandTo(templateString))

setEndPosition(anIndex)

Sets the index in the string where the receiver should stop searching. It will be as if the string ends at that index. If index is nil, the end position will be set to the end of string. Returns self.

    	Io> "funkadelic" matchesOfRegex("\\w+") setEndPosition(4) next string
    	==> funk

    	Io> "funkadelic" matchesOfRegex("\\w+") setEndPosition(nil) next string
    	==> funkadelic

setPosition(aRegexOrString)

Sets the search position to the given index in the string. Returns self.
setRegex(aRegexOrString)

Sets the regex to find matches in. Returns self.
setString(aString)

Sets the string to find matches in. Returns self.
splitString

Splits the string being matched against into pieces using the regex as the delimiter and returns the piece as a list of strings.
string

Returns the string that the receiver finds matches in.