issue with regex in C#

Posted by Dilip on Stack Overflow See other posts from Stack Overflow or by Dilip
Published on 2012-12-13T16:55:51Z Indexed on 2012/12/13 17:03 UTC
Read the original article Hit count: 174

Filed under:

my file is

> A B C D unuse data  <begin> Addd as ss 1 My name is 2323 33 text 
> </end> 34344 no need

and my code is

StringBuilder mSb = new StringBuilder();
           StreamReader sr = new StreamReader(@"E:\check.txt");
           String line;

           while (sr.ReadLine() != null)
           {

               mSb.AppendLine(sr.ReadLine());

           }
string matc = new Regex(@"(<begin>)(\n?.*)*</end>)?").Match(mSb.ToString()).ToString();

here it reading all file , but i just want till if i am removing ? from end , my program is crashing ..

Thanks

© Stack Overflow or respective owner

Related posts about c#