forked from pieter/gitx
-
Notifications
You must be signed in to change notification settings - Fork 4
/
NSString_RegEx.h
34 lines (25 loc) · 1.07 KB
/
NSString_RegEx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// NSString_RegEx.h
//
// Created by John R Chang on 2005-11-08.
// This code is Creative Commons Public Domain. You may use it for any purpose whatsoever.
// http://creativecommons.org/licenses/publicdomain/
//
#import <Foundation/Foundation.h>
/*
For regular expression help, see re_format(7) man page.
*/
@interface NSString (RegEx)
/*
Common <options> are REG_ICASE and REG_NEWLINE. For other possible option flags,
see regex(3) man page. You don't need to specify REG_EXTENDED.
<nmatch> is the number of subexpressions to match.
Returns an array of strings. The first string is the matching substring,
the remaining are the matching subexpressions, up to nmatch+1 number.
If nmatch is -1, works like grep. Returns an array containing self if matching.
Returns nil if regular expression does not match or if an error has occurred.
*/
- (NSArray *) substringsMatchingRegularExpression:(NSString *)pattern count:(int)nmatch
options:(int)options ranges:(NSArray **)ranges error:(NSError **)error;
- (BOOL) grep:(NSString *)pattern options:(int)options;
@end