0
NSString *[email protected]"AA.BB Hello \nCC.JJ Say \nBB.CC Bye \nZZ.AA To";
NSRange r;
while ((r=[inputStr rangeOfString:@"(^[A-L].*)" options:NSRegularExpressionSearch]).location!=NSNotFound) {
NSString *newStr=[inputStr substringWithRange:r];
inputStr=[inputStr stringByReplacingCharactersInRange:r withString:@""];
NSLog(@"NEW str= %@",newStr);
}
제공 : AA.BB 안녕하세요. 내가정규식 구문 문제 objective-c
AA.BB
CC.JJ 아래로, 범위 AL에 접미사를 찾고 있어요
하지만,
BB.CC는
는 그럼으로 (^[A-L].\*)
교체 (^[A-L]*$[\\s])
. 따라서 A-L에서 시작하여 공간을 찾을 때 끝나야합니다. 그러나 이것은 아무 것도 출력하지 않습니다.