#import <objc/objc.h>
#import <objc/Object.h>
#import <Foundation/Foundation.h>

@implementation TestObj
int main()
{
	NSString *pattern = @"^/api/v1/news/([0-9]+)/\\?categoryId=([0-9]+)$";
	NSString *string = @"/api/v1/news/123/?categoryId=22";
    NSError *error = nil;
    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:&error];
	NSTextCheckingResult *match = [regex firstMatchInString:string 
								options:0 
								range:NSMakeRange(0, string.length)];
    NSLog(@"Group 1 number: %@", [string substringWithRange:[match rangeAtIndex:1]]);
    NSLog(@"Group 2 number: %@", [string substringWithRange:[match rangeAtIndex:2]]);
	return 0;
}
@end