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

Recommended Answers

All 2 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.