4 // Created by John R Chang on 2005-11-08.
5 // This code is Creative Commons Public Domain. You may use it for any purpose whatsoever.
6 // http://creativecommons.org/licenses/publicdomain/
9 #import <Foundation/Foundation.h>
12 For regular expression help, see re_format(7) man page.
15 @interface
NSString (RegEx
)
18 Common <options> are REG_ICASE and REG_NEWLINE. For other possible option flags,
19 see regex(3) man page. You don't need to specify REG_EXTENDED.
21 <nmatch> is the number of subexpressions to match.
22 Returns an array of strings. The first string is the matching substring,
23 the remaining are the matching subexpressions, up to nmatch+1 number.
25 If nmatch is -1, works like grep. Returns an array containing self if matching.
27 Returns nil if regular expression does not match or if an error has occurred.
29 - (NSArray
*) substringsMatchingRegularExpression
:(NSString
*)pattern count
:(int)nmatch
30 options
:(int)options ranges
:(NSArray
**)ranges error
:(NSError
**)error
;
32 - (BOOL
) grep
:(NSString
*)pattern options
:(int)options
;