contains behavior related to assignment

Mimics
Inactive cells
Active cells
Specs
Inactive cells (details)
kind = "Regexp Match"
Active cells (details)
[](index)

Takes one indexing argument that should be either a number, a range, a text or a symbol. if it's a number or a range of numbers, these will specify the index of the capture to return. 0 is the whole match. negative indices are interpreted in the usual way. if the range is out of range it will only use as many groups as there are. if it's a text or a sym it will be interpreted as a the name of a named group to return. if an index isn't correct or wasn't matched, it returns nil in those places.

afterMatch()

returns the part of the target after the text that matched

asList()

returns a list of all groups captured in this match. if a group is not matched it will be nil in the list. the actual match text is the first element in the list.

asText(...)

nil

beforeMatch()

returns the part of the target before the text that matched

captures()

returns a list of all groups captured in this match. if a group is not matched it will be nil in the list. the actual match text is not included in this list.

end(index 0)

Takes one optional argument that should be either a number or a symbol. this should be the name or index of a group to return the end index for. if no index is supplied, 0 is the default. if the group in question wasn't matched, returns -1.

length()

returns the number of groups available in this match

match()

returns the text that matched

namedOffsets()

returns a dictionary of all the names in this match. the keys will be symbols and the values either pairs of indices or nil

method(
  names inject({}, sum, name, sum +({}(name =>(offset(name))))) 
  )
names()

returns a list of all the named groups in the regular expression used to create this match

offset(index 0)

Takes one optional argument that should be either a number or a symbol. this should be the name or index of a group to return the start and end index for. if no index is supplied, 0 is the default. if the group in question wasn't matched, returns nil, otherwise a pair of the start and end indices.

offsets()

returns all the offsets for this match, including the full match. the result is a list of pairs, or nil for the groups that wasn't matched

method(
  (0 ...(length)) map(n, offset(n)) 
  )
pass()

will get the named group corresponding to the name of the message, or nil if the named group hasn't been matched. will signal a condition if no such group is defined.

start(index 0)

Takes one optional argument that should be either a number or a symbol. this should be the name or index of a group to return the start index for. if no index is supplied, 0 is the default. if the group in question wasn't matched, returns -1.

target()

Returns the target that this match was created against