0

Hi Guys,
I want to store the values of regex.match in an array but i am getting error.
my code is as follows

string[] subj = null;
for (int f = 1; f <= dir.Length; f++)
                   {

                               
                               Match o = Regex.Match(txt1, "section_title='(?<TITLE>.*)'");
                               
                               subj[f] = o.Groups[1].Value;
                               
                             
                                                         }
               }  



                       


                   }

can you tell me how can i do this.Thanks

3
Contributors
2
Replies
6
Views
6 Years
Discussion Span
Last Post by __avd
0

Use a generic list instead:

List<string> subj = new List<string>;
for (int f = 1; f <= dir.Length; f++)
{                              
       Match o = Regex.Match(txt1, "section_title='(?<TITLE>.*)'");
                               
       subj.Add(o.Groups[1].Value);
                               
}
}
}

Thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.