c# - extract string between 2 special strings -


this example of string that's wanna extract b3d0191ab22cb8713f2d00ff155f030e89f0ea7b&dn=youtube%20top%20100%20week%2016&tr=udp%3a%2f%2ftracker.leeche

i wanna extract youtube%20top%20100%20week%2016

i tried many regex patterns none of them work ideas or ??

since want parse url query, don't need regex. use httputility.parsequerystring

var parts = system.web.httputility.parsequerystring("b3d0191ab22cb8713f2d00ff155f030e89f0ea7b&dn=youtube%20top%20100%20week%2016&tr=udp%3a%2f%2ftracker.leeche"); var url = parts["dn"]; 

similarly, can use uribuilder

var text = new uribuilder() { query = "b3d0191ab22cb8713f2d00ff155f030e89f0ea7b&dn=youtube%20top%20100%20week%2016&tr=udp%3a%2f%2ftracker.leeche" }             .uri.parsequerystring()["dn"]; 

both methods return youtube top 100 week 16 (unescaping %20)


Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -