Parse URL using Regex

2019-09-16 19:14发布

1条回答
够拽才男人
2楼-- · 2019-09-16 19:38

YouTube:

ResultString = Regex.Replace(SubjectString, "http.*?v[=/]([^\s&#]+)\S+", "http://img.youtube.com/vi/$1/default.jpg", RegexOptions.IgnoreCase)

DailyMotion:

A simple string replace would do, but here is the regex:

ResultString = Regex.Replace(SubjectString, "http://www\.dailymotion\.com/video/", "http://www.dailymotion.com/thumbnail/video/", RegexOptions.IgnoreCase)
查看更多
登录 后发表回答