NSMutableString RegexKit Additions Reference

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

Capture Subpattern Reference Syntax

Refer to Capture Subpattern Reference Syntax for additional information regarding search and replace.

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

Search and Replace

Instance Methods

Modifies the receiver by repeatedly searching the receiver with aRegex and replacing up to count matches with the text of replacementString after capture references have been expanded.
- (RKUInteger)match:(id)aRegex replace:(const RKUInteger)count withString:(NSString * const)replacementString;
Parameters
Discussion

This method is identical to stringByMatching:replace:withReferenceString: except that this method modifies the mutable receiver directly instead of creating a new NSString that contains the result of the search and replace.

Return Value
Modifies the receiver by repeatedly searching the receiver with aRegex and replacing up to count matches with the text of replacementString after capture references have been expanded. Returns the number of match and replace operations performed.
 
RegexKit project hosted by: