.net - C# Regular Expressions info from urls -
i have following urls:
http://vk.com/video#/video219171498_166164529 http://vk.com/video?gid=21095903#/video-21095903_165699050 http://vk.com/video#/video219171498_166164529
i need take info 'video219171498_166164529' these strings. maybe there code can take 'video' , 19 symbols after. sorry english
i'm not sure if title of question important or not, extend on other peoples valid answers, if did need(?) use regular expressions achieve same outcome others. c# uses system.text.regularexpressions extract "video..." string.
string pattern = "(video[\w-]+)"; string url = "http://blahblah/video-12341237293"; match match = regex.match(url, pattern); // here can test match check there match in first place // multiple urls dynamic rather static above example string result = match.groups[1].value;
in above, result equal matching string within url. using match check there match in first place mean can put in loop , traverse list/array etc etc without needing know url values, or change pattern specific cases.
anyway, might not need regex incase did, hope above helps.
Comments
Post a Comment