Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
Questionre:vs C# versus vsC++ Pin
Alan Kurlansky26-Jan-10 17:28
Alan Kurlansky26-Jan-10 17:28 
AnswerRe: re:vs C# versus vsC++ Pin
tolw26-Jan-10 19:56
tolw26-Jan-10 19:56 
GeneralRe: re:vs C# versus vsC++ Pin
Alan Kurlansky27-Jan-10 4:08
Alan Kurlansky27-Jan-10 4:08 
GeneralRe: re:vs C# versus vsC++ Pin
tolw27-Jan-10 6:14
tolw27-Jan-10 6:14 
Questionregex help Pin
uglyeyes26-Jan-10 13:34
uglyeyes26-Jan-10 13:34 
Answerrepost Pin
Luc Pattyn26-Jan-10 13:40
sitebuilderLuc Pattyn26-Jan-10 13:40 
AnswerRe: regex help Pin
vivasaayi26-Jan-10 18:19
vivasaayi26-Jan-10 18:19 
GeneralRe: regex help Pin
uglyeyes26-Jan-10 21:15
uglyeyes26-Jan-10 21:15 
no only the text i have provided you is valid. the content of the entire csv files has text like

----1----

my contents..

----2----

my content2..

...
...
so could you please help how to extract the data i want?

i have this regex that seem to work to get text between div tag
?<=\<div class=""middlead""\>).*?(?=\</div\>


but i need to get description of apple too. i tried to use below code

string fName = @"data.txt";//path to text file
            StreamReader testTxt = new StreamReader(fName);
            string allRead = testTxt.ReadToEnd();//Reads the whole text file to the end
            testTxt.Close(); //Closes the text file after it is fully read.

            //Regex rx = new Regex(@"(?<=\<div class=""middlead""\>).*?(?=\</div\>)", RegexOptions.Singleline);
            Regex rx1 = new Regex(@"(?<=\<p\>&nbsp;&nbsp;&nbsp;\</p\>).*?(?=\</p\>)", RegexOptions.Singleline);

                

            //MatchCollection matches = rx.Matches(allRead);
            MatchCollection matches1 = rx1.Matches(allRead);

            StreamWriter sw = new StreamWriter(@"realdata.txt");
            int count = 0;
            foreach (Match match in matches1)
            {
                sw.WriteLine(count.ToString());
                sw.WriteLine(match.ToString());

                foreach (Match match1 in matches1)
                {
                    sw.WriteLine(match1.ToString());
                }
                count++;

            }
            sw.Close();


          
            
        }

but some how regex rx1 is not only giving text that i want but its doing greedy matching and try to match everything that has



could you please help as to how can i extract the description of those products.
GeneralRe: regex help Pin
#realJSOP27-Jan-10 1:24
mve#realJSOP27-Jan-10 1:24 
GeneralRe: regex help Pin
uglyeyes27-Jan-10 2:26
uglyeyes27-Jan-10 2:26 
GeneralRe: regex help Pin
basantakumar27-Jan-10 3:20
basantakumar27-Jan-10 3:20 
GeneralRe: regex help [modified] Pin
uglyeyes27-Jan-10 11:35
uglyeyes27-Jan-10 11:35 
GeneralRe: regex help Pin
uglyeyes27-Jan-10 16:48
uglyeyes27-Jan-10 16:48 
GeneralRe: regex help Pin
uglyeyes27-Jan-10 18:41
uglyeyes27-Jan-10 18:41 
GeneralRe: regex help Pin
uglyeyes28-Jan-10 12:50
uglyeyes28-Jan-10 12:50 
GeneralRe: regex help Pin
Ravi Sant14-Apr-11 1:42
Ravi Sant14-Apr-11 1:42 
GeneralRe: regex help [modified] Pin
ahmed_elshiwy4-Jan-13 0:59
ahmed_elshiwy4-Jan-13 0:59 
QuestionVery Basic question in network programming Pin
ashish8patil26-Jan-10 11:09
ashish8patil26-Jan-10 11:09 
AnswerRe: Very Basic question in network programming Pin
Nicholas Butler26-Jan-10 12:44
sitebuilderNicholas Butler26-Jan-10 12:44 
QuestionMarshalling Pin
3bood.ghzawi26-Jan-10 11:06
3bood.ghzawi26-Jan-10 11:06 
AnswerRe: Marshalling Pin
DaveyM6926-Jan-10 11:52
professionalDaveyM6926-Jan-10 11:52 
GeneralRe: Marshalling Pin
Luc Pattyn26-Jan-10 13:42
sitebuilderLuc Pattyn26-Jan-10 13:42 
QuestionDisplaying the contents of a List&lt;string[]&gt; in a ListBox Pin
Douglas Kirk26-Jan-10 9:47
Douglas Kirk26-Jan-10 9:47 
AnswerRe: Displaying the contents of a List&lt;string[]&gt; in a ListBox Pin
DaveyM6926-Jan-10 10:33
professionalDaveyM6926-Jan-10 10:33 
GeneralRe: Displaying the contents of a List&lt;string[]&gt; in a ListBox Pin
Douglas Kirk26-Jan-10 10:58
Douglas Kirk26-Jan-10 10:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.