.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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -