I am getting System.IndexOutOfRangeException everytime I try to compile my program. This is where the error is happening.

public static string findlinks2(string source) 
                char quotes = (char)34; //sets the char variable to quotes since you can't use it in a string normally
                string searchstring = (quotes + "fmt_url_map" + quotes + ":" + quotes); //sets the searchstring to "fmt_url_map":
                string[] fmt1 = System.Text.RegularExpressions.Regex.Split(source, searchstring); //splits html into 2 arrays
                string fmt2 = fmt1[1].ToString();

The error is occuring when is trys to assign the variable fmt2 the contents of fmt[1].ToString();. The error is obviously because the array fmt[1] does not exist but I dont know why???

It doesn't exist because it is not finding your search string.

Thanks I just realised I was searching for the wrong string. Big help!!! Is there any sort of systemj where I can give you a thumbs up on DANIWEB? I only joined last week

This question has already been answered. Start a new discussion instead.