Search code examples
iosobjective-cvimeo

Extract vimeo video Id from vimeo url objective-c


I want to extract video id from a vimeo url, can any body help me with the RegEx for the same.

Video url can be of type

https://vimeo.com/173652088

this is just a sample url. RegEx should work for all vimeo urls.


Solution

  • plz try this code

    NSString *yourStr = @"https://vimeo.com/173652088";
    NSString *str = [yourStr stringByReplacingOccurrencesOfString: @"https://" withString:@""];
    
     NSArray *arryVedios =[str componentsSeparatedByString:@"/"] ;
    
    NSString *id= [ arryVedios lastObject];
     NSLog(@"id= %@",id);
    

    this code work for every url.but your id must be in last.