المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : regex problem [modified]



C# Programming
01-16-2010, 01:22 AM
Hi,
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 = @"(?).*?(?=\)"; //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






asdf

asdf
asdfasdf

asdf
(See on map)

asdf






asdf



please note the spacing in the content, not sure if it matters?

modified on Thursday, January 14, 2010 10:06 PM