Click here to Skip to main content
15,917,176 members
Home / Discussions / C#
   

C#

 
Questionregex problem [modified] Pin
uglyeyes12-Jan-10 18:14
uglyeyes12-Jan-10 18:14 
AnswerRe: regex problem Pin
OriginalGriff12-Jan-10 23:05
mveOriginalGriff12-Jan-10 23:05 
GeneralRe: regex problem Pin
uglyeyes13-Jan-10 0:25
uglyeyes13-Jan-10 0:25 
GeneralRe: regex problem Pin
OriginalGriff13-Jan-10 0:30
mveOriginalGriff13-Jan-10 0:30 
GeneralRe: regex problem Pin
uglyeyes13-Jan-10 18:07
uglyeyes13-Jan-10 18:07 
GeneralRe: regex problem Pin
OriginalGriff13-Jan-10 21:37
mveOriginalGriff13-Jan-10 21:37 
AnswerRe: regex problem Pin
carlecomm13-Jan-10 19:19
carlecomm13-Jan-10 19:19 
GeneralRe: regex problem Pin
uglyeyes13-Jan-10 19:28
uglyeyes13-Jan-10 19:28 
makes no difference how so ever. my regex works fine in a regextest tool its just only when i try to filter the content via c# it doesnt work. here is my 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.
           string regMatch = @"(?<=\<div class=""middleadimggold""\>).*?(?=\</div\>)"; //string to search for inside of text file. It is case sensitive.
           if (Regex.IsMatch(allRead, regMatch))//If the match is found in allRead
           {
               Console.WriteLine("found\n");

           }
           else
           {
               Console.WriteLine("not found\n");
           }


part of the content that should match

<div class="middleadimggold">

		 

	 <a  class="asdf" href="http://www.asdf">
		 asdf</a>
   <p>
		 asdf</p>
		<p>asdf</p><p>asdf</p>
			  	 
			 <p><span class="blue">asdf</span>
			 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="de" href="http://www.4asdf"><span class="a">(See on map)</span></a></p>
		   
		<p><span class="blue">asdf</span></p>
		
		
	
		 <span class="xx">


asdf
  </span>
	
  </div>


please note the spacing in the content, not sure if it matters?
AnswerRe: regex problem Pin
Ravi Sant14-Apr-11 1:47
Ravi Sant14-Apr-11 1:47 
QuestionTroubles Drawing a Rubik Cube to windows form. Pin
Are Jay12-Jan-10 16:56
Are Jay12-Jan-10 16:56 
Questiongetting country code based on IP Pin
uglyeyes12-Jan-10 16:37
uglyeyes12-Jan-10 16:37 
AnswerRe: getting country code based on IP Pin
Dave Kreskowiak12-Jan-10 18:32
mveDave Kreskowiak12-Jan-10 18:32 
GeneralRe: getting country code based on IP Pin
uglyeyes12-Jan-10 19:10
uglyeyes12-Jan-10 19:10 
GeneralMessage Closed Pin
12-Jan-10 21:17
stancrm12-Jan-10 21:17 
GeneralRe: getting country code based on IP Pin
uglyeyes13-Jan-10 0:26
uglyeyes13-Jan-10 0:26 
GeneralRe: getting country code based on IP Pin
uglyeyes13-Jan-10 14:32
uglyeyes13-Jan-10 14:32 
Questioncall form problem? Pin
miss YY12-Jan-10 16:01
miss YY12-Jan-10 16:01 
AnswerRepost! Pin
DaveyM6912-Jan-10 22:21
professionalDaveyM6912-Jan-10 22:21 
AnswerCross Post Pin
<<Tash18>>13-Jan-10 0:50
<<Tash18>>13-Jan-10 0:50 
AnswerRe: call form problem? Pin
carlecomm13-Jan-10 19:24
carlecomm13-Jan-10 19:24 
QuestionWhat is the connection string for connecting your C# to a remote server ? Pin
jedongkendrick12-Jan-10 15:07
jedongkendrick12-Jan-10 15:07 
AnswerRe: What is the connection string for connecting your C# to a remote server ? Pin
Not Active12-Jan-10 15:43
mentorNot Active12-Jan-10 15:43 
AnswerRe: What is the connection string for connecting your C# to a remote server ? Pin
Abhinav S12-Jan-10 16:13
Abhinav S12-Jan-10 16:13 
AnswerRe: What is the connection string for connecting your C# to a remote server ? Pin
Dave Kreskowiak12-Jan-10 18:31
mveDave Kreskowiak12-Jan-10 18:31 
QuestionHow to use values from the datagrid to add values to a database Pin
jedongkendrick12-Jan-10 15:05
jedongkendrick12-Jan-10 15:05 

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.