在正则表达式中,一个正则表达式的结果可能是另一个正则表达式的输入。
就像unix / linux中的一个例子,当我们触发命令时:
NSString *urlString = [baseUrlString stringByAppendingString:@"account/avatar"];
NSDictionary *parameters = @{@"token": self.token};
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
NSURL *url = [NSURL URLWithString:@"account/avatar" relativeToURL:self.baseUrl];
NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:urlString parameters:parameters error:nil];
//[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
//[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithRequest:request fromFile:filePath progress:nil completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
if (error) {
NSLog(@"Error: %@", error);
} else {
NSLog(@"Success: %@ %@", response, responseObject);
}
}];
[uploadTask resume];
第一个$ls -l | grep "Aug"
的结果是ls
的输入。