I have a string that has bunch of text. I need to locate all values that are located between
‘site.com/PI/’ and ‘/500/item.jpg
Example:
String STRING = @"
http://site.com/PI/0/500/item.jpg
blah-blah
http://site.com/PI/1/500/item.jpg
blah-blah
http://site.com/PI/2/500/item.jpg
blah-blah
http://site.com/PI/4/500/item.jpg
blah-blah
http://site.com/PI/8/500/item.jpg
blah-blah
http://site.com/PI/6/500/item.jpg blah-blah"
need to get list of { 0, 1, 2, 4, 8, 6 }
It is easy to get one occurence using regex:
Regex.Match(STRING, @"(?<=/PI/).*(?=/500/)").Value;
How can I get all occurencies into one list?
You can use LINQ.