Click here to Skip to main content
15,903,175 members
Home / Discussions / C#
   

C#

 
AnswerRe: Line on open/close brackets Pin
PIEBALDconsult21-Jul-10 18:22
mvePIEBALDconsult21-Jul-10 18:22 
Questionconvert date question Pin
Jassim Rahma21-Jul-10 3:36
Jassim Rahma21-Jul-10 3:36 
AnswerRe: convert date question Pin
OriginalGriff21-Jul-10 3:46
mveOriginalGriff21-Jul-10 3:46 
AnswerRe: convert date question Pin
Luc Pattyn21-Jul-10 3:47
sitebuilderLuc Pattyn21-Jul-10 3:47 
Questionhow to open www.google.com and insert any text to the textbox search (only for show) Pin
Gali197821-Jul-10 3:32
Gali197821-Jul-10 3:32 
AnswerRe: how to open www.google.com and insert any text to the textbox search (only for show) Pin
Luc Pattyn21-Jul-10 3:46
sitebuilderLuc Pattyn21-Jul-10 3:46 
GeneralRe: how to open www.google.com and insert any text to the textbox search (only for show) Pin
Jason Vetter21-Jul-10 4:31
Jason Vetter21-Jul-10 4:31 
QuestionRegex Problem,Extracting text from Table Pin
NaveenHS21-Jul-10 2:03
NaveenHS21-Jul-10 2:03 
Hello Everyone,

I am trying to extract the contents of the table from a static HTML file.
Program is almost giving the expected output.

Program :-
class Program
	{
		static void Main()
		{
			StreamReader str = new StreamReader("C:\\AllRoles.html");
			string SFile = str.ReadToEnd();
						
		    Regex regex = new Regex(
				@"<tr>(\s* <td[^>]*>  \s* (?<value>[^<]*?) \s* </td> )+ \s*</tr>",
		 		RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);


			 foreach( Match m in regex.Matches( SFile ) )
			 {
				foreach( Capture item in m.Groups["value"].Captures ) {

				Console.WriteLine( item.Value );
			}
			
				Console.WriteLine( );
			}
				Console.ReadLine();
		}
	}



I am facing one problem there is a comment in between the table content


HTML File :-


<table border="0" cellpadding="5" cellspacing="0" width="100%">
            <tbody><tr>
            <td class="columnheading" nowrap="nowrap">Last Name</td>
            <td class="columnheading" nowrap="nowrap">First Name</td>
           <td class="columnheading" nowrap="nowrap">Role</td>
           <td class="columnheading">Term</td>
           <td class="columnheading">Company</td>
           </tr>
           <tr>
           <td valign="top">

           <!-- Logic Here-->


           Gottlieb

           </td>
           <td valign="top">Pradep</td>
           <td valign="top">President

           </td>
           <td valign="top">8/15/2009 - 9/1/2010</td>
           <td valign="top">DSCMIT</td>

           </tr>
           <tr>
           <td valign="top">
           <!-- Logic Here-->


           Rajesh

           </td>
           <td valign="top">H</td>
           <td valign="top"> President

           </td>
           <td valign="top">8/15/2009 - 8/14/2010</td>
           <td valign="top">BHSIT</td>
           </tr>



I am getting the Output as

Last Name
First Name
Role
Term
Company

and it stops at this line <!-- Logic Here-->

Can anyone please help me to solve this problem.

Thanking you,
Naveen HS
AnswerRe: Regex Problem,Extracting text from Table Pin
Luc Pattyn21-Jul-10 2:13
sitebuilderLuc Pattyn21-Jul-10 2:13 
QuestionFunction Call Mechanism Pin
califax2k20-Jul-10 23:15
califax2k20-Jul-10 23:15 
AnswerRe: Function Call Mechanism Pin
PIEBALDconsult21-Jul-10 2:37
mvePIEBALDconsult21-Jul-10 2:37 
QuestionHow to call C# function from unmanaged C++ code.? Pin
deadlyabbas20-Jul-10 19:58
deadlyabbas20-Jul-10 19:58 
AnswerRe: How to call C# function from unmanaged C++ code.? Pin
Luc Pattyn20-Jul-10 23:14
sitebuilderLuc Pattyn20-Jul-10 23:14 
AnswerRe: How to call C# function from unmanaged C++ code.? Pin
Pete O'Hanlon21-Jul-10 2:34
mvePete O'Hanlon21-Jul-10 2:34 
QuestionOpening a binary document from db is failing Pin
seeism20-Jul-10 19:04
seeism20-Jul-10 19:04 
AnswerRe: Opening a binary document from db is failing Pin
Abhinav S20-Jul-10 19:12
Abhinav S20-Jul-10 19:12 
GeneralRe: Opening a binary document from db is failing Pin
seeism20-Jul-10 19:20
seeism20-Jul-10 19:20 
GeneralRe: Opening a binary document from db is failing Pin
Goutam Patra20-Jul-10 20:06
professionalGoutam Patra20-Jul-10 20:06 
GeneralRe: Opening a binary document from db is failing Pin
seeism20-Jul-10 20:22
seeism20-Jul-10 20:22 
GeneralRe: Opening a binary document from db is failing PinPopular
seeism20-Jul-10 20:42
seeism20-Jul-10 20:42 
GeneralRe: Opening a binary document from db is failing Pin
seeism21-Jul-10 18:24
seeism21-Jul-10 18:24 
GeneralRe: Opening a binary document from db is failing Pin
Goutam Patra21-Jul-10 20:24
professionalGoutam Patra21-Jul-10 20:24 
GeneralRe: Opening a binary document from db is failing Pin
seeism21-Jul-10 22:23
seeism21-Jul-10 22:23 
GeneralRe: Opening a binary document from db is failing Pin
Goutam Patra21-Jul-10 23:05
professionalGoutam Patra21-Jul-10 23:05 
GeneralRe: Opening a binary document from db is failing Pin
seeism21-Jul-10 23:14
seeism21-Jul-10 23:14 

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.