Methods



findAllInString:


- (NSArray *)findAllInString:(NSString *)str; 

Calls findAllInString:range: using the full range of the target string.


findAllInString:range:


- (NSArray *)findAllInString:(NSString *)str range:(NSRange)r; 

Returns an array of all non-overlapping occurrences of the regex in the given range of the target string. The members of the array are AGRegexMatches.


findEnumeratorInString:


- (NSEnumerator *)findEnumeratorInString:(NSString *)str; 

Calls findEnumeratorInString:range: using the full range of the target string.


findEnumeratorInString:range:


- (NSEnumerator *)findEnumeratorInString:(NSString *)str range:(NSRange)r; 

Returns an enumerator for all non-overlapping occurrences of the regex in the given range of the target string. The objects returned by the enumerator are AGRegexMatches.


findInString:


- (AGRegexMatch *)findInString:(NSString *)str; 

Calls findInString:range: using the full range of the target string.


findInString:range:


- (AGRegexMatch *)findInString:(NSString *)str range:(NSRange)r; 

Returns an AGRegexMatch for the first occurrence of the regex in the given range of the target string or nil if none is found.


initWithPattern:


- (id)initWithPattern:(NSString *)pat; 

Initializes the regex using the given pattern string. Returns nil if the pattern string is invalid.


initWithPattern:options:


- (id)initWithPattern:(NSString *)pat options:(int)opts; 

Initializes the regex using the given pattern string and option flags. Returns nil if the pattern string is invalid.


regexWithPattern:


+ (id)regexWithPattern:(NSString *)pat; 

Creates a new regex using the given pattern string. Returns nil if the pattern string is invalid.


regexWithPattern:options:


+ (id)regexWithPattern:(NSString *)pat options:(int)opts; 

Creates a new regex using the given pattern string and option flags. Returns nil if the pattern string is invalid.


replaceWithString:inString:


- (NSString *)replaceWithString:(NSString *)rep inString:(NSString *)str; 

Calls replaceWithString:inString:limit: with no limit.


replaceWithString:inString:limit:


- (NSString *)replaceWithString:(NSString *)rep inString:(NSString *)str limit:(int)lim; 

Returns the string created by replacing occurrences of the regex in the target string with the replacement string. If the limit is positive, no more than that many replacements will be made.

Captured subpatterns can be interpolated into the replacement string using the syntax $x or ${x} where x is the index or name of the subpattern. $0 and $& both refer to the entire pattern. Additionally, the case modifier sequences \U...\E, \L...\E, \u, and \l are allowed in the replacement string. All other escape sequences are handled literally.


splitString:


- (NSArray *)splitString:(NSString *)str; 

Call splitString:limit: with no limit.


splitString:limit:


- (NSArray *)splitString:(NSString *)str limit:(int)lim; 

Returns an array of strings created by splitting the target string at each occurrence of the pattern. If the limit is positive, no more than that many splits will be made. If there are captured subpatterns, they are returned in the array.

(Last Updated 9/12/2003)