正则表达式VEVO网址的视频ID [英] Regex vevo URL video-id
本文介绍了正则表达式VEVO网址的视频ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要的视频ID从vevo.com URL匹配。
I want to match the video-ID from a vevo.com URL.
例如网址:
http://www.vevo.com/watch/arash/she-makes-me-go/SE2VJ1200401
该ID将 SE2VJ1200401
。我试着模式 /(。*){12}
,但没有奏效。
The ID would be SE2VJ1200401
. I tried the pattern /(.*){12}
but that did not work.
推荐答案
我想你可能瞄准的是:
/(.{12})
但是,这也将匹配 // www.vevo.c
和 /手表/阿拉什/
。如果你想将其限制在网址刚刚过去的一部分,你可以使用:
But that will also match //www.vevo.c
and /watch/arash/
. If you want to limit it to just the last part of the URL, you could use:
/(.{12})$
不过,你可能要考虑使用 \ W
(任何字符)或 \ S
(任何非-whitespace字符代替)
例如:
However, you may want to consider using \w
(any word character) or \S
(any non-whitespace character) instead of .
For instance:
/(\w{12})$
/(\S{12})$
这篇关于正则表达式VEVO网址的视频ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文