Here the example.
Starts with : imgurl=
Ends with : &
Example extraction
asfasfasfasimgurl=http://www.mysite.com&asgasgas
Result: http://www.mysite.com
So how can I write regex to extract all instances like this?
You can use lookbehind and lookahead
(?<=imgurl=).*?(?=&)
You can get a list of urls using
List<String> urls=Regex.Matches(input,regex)
.Cast<Match>()
.Select(x=>x.Value)
.ToList();
A simple regex could be:
(?:imgurl=)(.*)(?:&)
the (?:[stuff here]) is a non-capture group. It requires the pattern to match, but not capture/extract. The (.*) captures everything in-between the two non-capture groups.
Also to learn more about capture groups you can read here What is a non-capturing group? What does a question mark followed by a colon (?:) mean?