NSArray RegexKit Additions Reference

Extends by categoryNSArray
RegexKit0.6.0 Release Notes
PCRE7.6
AvailabilityAvailable in Mac OS X v10.4 or later.
Declared in
  • RegexKit/NSArray.h
Overview

Specifying a Regular Expression

When specifying a regular expression, the regular expression can be either a RKRegex object or a NSString containing the text of a regular expression. When specified as a NSString, as determined by sending isKindOfClass:, the receiver will convert the string to a RKRegex object via regexWithRegexString:options:.

Important:
The method will raise NSInvalidArgumentException if the regular expression is nil. If passed as a NSString, the method will raise RKRegexSyntaxErrorException if the regular expression is not valid.

Determining if an Object Matches a Regular Expression

Objects are sent isMatchedByRegex: to determine whether or not they are matched by the specified regular expression.

Tasks

Deriving New Arrays
Querying an Array

Instance Methods

Returns a new array that contains all the objects in the receiver matching aRegex.
- (NSArray *)arrayByMatchingObjectsWithRegex:(id)aRegex;
Returns a new array that contains all the objects in the receiver matching aRegex within the specified range.
- (NSArray *)arrayByMatchingObjectsWithRegex:(id)aRegex inRange:(const NSRange)range;
Returns a Boolean value that indicates whether an object matching aRegex is present in the receiver.
- (BOOL)containsObjectMatchingRegex:(id)aRegex;
Return Value
YES if an object that is matched by aRegex is present in the receiver, otherwise NO.
Returns a Boolean value that indicates whether an object in the specified range matching aRegex is present in the receiver.
- (BOOL)containsObjectMatchingRegex:(id)aRegex inRange:(const NSRange)range;
Return Value
YES if an object that is matched by aRegex is present in the receiver, otherwise NO.
Returns the number of objects matching aRegex in the receiver.
- (RKUInteger)countOfObjectsMatchingRegex:(id)aRegex;
Returns the number of objects matching aRegex in the receiver within the specified range.
- (RKUInteger)countOfObjectsMatchingRegex:(id)aRegex inRange:(const NSRange)range;
Searches the receiver for an object that matches aRegex and returns the lowest index whose corresponding array value is equal to the matched object.
- (RKUInteger)indexOfObjectMatchingRegex:(id)aRegex;
Discussion
If none of the objects in the receiver are matched by aRegex, indexOfObjectMatchingRegex: returns NSNotFound.
Searches the specified range within the receiver for an object that matches aRegex and returns the lowest index whose corresponding array value is equal to the matched object.
- (RKUInteger)indexOfObjectMatchingRegex:(id)aRegex inRange:(const NSRange)range;
Discussion
If none of the objects in the specified range are matched by aRegex, indexOfObjectMatchingRegex:inRange: returns NSNotFound.
Searches the receiver for objects that are matched by aRegex and returns a NSIndexSet containing the matching indexes.
- (NSIndexSet *)indexSetOfObjectsMatchingRegex:(id)aRegex;
Searches the specified range within the receiver for objects that are matched by aRegex and returns a NSIndexSet containing the matching indexes.
- (NSIndexSet *)indexSetOfObjectsMatchingRegex:(id)aRegex inRange:(const NSRange)range;
 
RegexKit project hosted by: