I basically have a Youtube url as an NSString, but I need to extract the video id that is displayed in the url. I found many tutorials on how to do this in php or and other
Sorry - I don't have enough rep to add a comment to the chosen answer.
After spending ages trying to find the correct syntax for the regex, I've come across this which has helped me. Hopefully it might help someone else!
NSString *regexString = @"(?<=v(=|/))([-a-zA-Z0-9_]+)|(?<=youtu.be/)([-a-zA-Z0-9_]+)";
Taken from here. This works for the following URL formats: