Nu Class Reference

NuRegexMatch

A single occurence of a regular expression.

Superclass: NSObject
Declared in: objc/regex.h, nu/doc.nu

A NuRegexMatch represents a single occurence of a regular expression within the target string. The range of each subpattern within the target string is returned by -range, -rangeAtIndex:, or -rangeNamed:. The part of the target string that matched each subpattern is returned by -group, -groupAtIndex:, or -groupNamed:. NuRegexMatch is a slight modification of Aram Greenman's AGRegexMatch, so far only changed to allow direct access to the NuRegex that was used to make the match. The NuRegexMatch documentation is from the AGRegex distribution and contains only minor modifications for Nu.

Methods

- (int) compare: (id) other
Compare matches by their location. This allows arrays of matches to be sorted.

in nu/doc.nu

- (int) count
The number of capturing subpatterns, including the pattern itself.

in objc/regex.h

- (NSString *) group
Returns the part of the target string that matched the pattern.

in objc/regex.h

- (NSString *) groupAtIndex: (int) idx
Returns the part of the target string that matched the subpattern at the given index or nil if it wasn't matched. The subpatterns are indexed in order of their opening parentheses, 0 is the entire pattern, 1 is the first capturing subpattern, and so on.

in objc/regex.h

- (NSString *) groupNamed: (NSString *) name
Returns the part of the target string that matched the subpattern of the given name or nil if it wasn't matched.

in objc/regex.h

- (NSRange) range
Returns the range of the target string that matched the pattern.

in objc/regex.h

- (NSRange) rangeAtIndex: (int) idx
Returns the range of the target string that matched the subpattern at the given index or {NSNotFound, 0} if it wasn't matched. The subpatterns are indexed in order of their opening parentheses, 0 is the entire pattern, 1 is the first capturing subpattern, and so on.

in objc/regex.h

- (NSRange) rangeNamed: (NSString *) name
Returns the range of the target string that matched the subpattern of the given name or {NSNotFound, 0} if it wasn't matched.

in objc/regex.h

- (NuRegex *) regex
The regular expression used to make this match.

in objc/regex.h

- (NSString *) string
Returns the target string.

in objc/regex.h