I have a string stored in a variable, say
myString= <RssFeeds<link>http://www.codeguru.com/icom_includes/feeds/codeguru/rss-all.xml</link>
<title>CodeGuru.com</title> <description>something</description></RssFeeds><RssFeeds><link>http://lifehacker.com/index.xml</link>
<title>Lifehacker</title>
<description>something</description>
</RssFeeds>
I want to extract the text between <link>and </link>
and also the text between <title>and </title>
in two different arrays.
How to do this, please help me. if anyone have code or any helpfull link please reply back.

Thanks

hi

Now Remember that i can only show you the door , you are the only person who have to walk throught it. i have created a substring and displayed them on the Messagebox, you have to assign that to the Array. here is the example code

String myString = @"<RssFeeds<link>http://www.codeguru.com/icom_includes/feeds/codeguru/rss-all.xml</link>
    <title>CodeGuru.com</title>   <description>something</description></RssFeeds><RssFeeds><link>http://lifehacker.com/index.xml</link>
    <title>Lifehacker</title>
    <description>something</description>
  </RssFeeds> ";
   MessageBox.Show(myString.Substring(15, 64)); /*It gave me [url]http://www.codeguru.com/icom_includes/feeds/codeguru/rss-all.xml[/url] */
   MessageBox.Show(myString.Substring(99,12)); //CodeGuru.com

Hope this Helps

Use a System.Text.RegularExpressions.Regex object.

Regex linkRegex = new Regex(@"<link>\s*(?<link>[^<]+)\s*</link>", System.Text.RegularExpressions.RegexOptions.Compiled);
            Regex titleRegex = new Regex(@"<title>\s*(?<title>[^<]+)\s*</title>", System.Text.RegularExpressions.RegexOptions.Compiled);

            if ( linkRegex.IsMatch(myString) ) {
                Match match = linkRegex.Match(myString);
                string theLink = match.Groups["link"].Value;
            }
            if ( titleRegex.IsMatch(myString) ) {
                Match match = titleRegex.Match(myString);
                string title = match.Groups["link"].Value;
            }
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.