need regex for youku video id [closed]

here’s how i would do it. id in first capture group.

youku\.com/(?:player.php/sid/|v_show/id_)([a-zA-Z0-9]+)(?:/|\\.)

i understand now that you use php as application language, which changes things a bit. you have to start and end the regular expression with a formality character of your own choice. for this regular expression i’d use the hash character, since it’s not used anywhere in the regular expression:

$regExp = "#youku\.com/(?:player.php/sid/|v_show/id_)([a-zA-Z0-9]+)(?:/|\\.)#";

Leave a Comment