Hi Lucky,
if your separtor length is always the same this
regex will work for you.
string content = null;
using (StreamReader sr = new StreamReader("Test.txt"))
{
String line = null;
while ((line = sr.ReadLine()) != null)
{
//if seperator line length 10
Regex rgx = new Regex("^-(-){8}-$");
if(rgx.IsMatch(line.Replace(@"\n","")))
continue;
content += line;
}
}
Cheers
Lars Behrmann
_________________
Nothing is impossible. UML is the key for all your problems.
AODL - Make your .net apps OpenOffice ready
http://aodl.sourceforge.net/ lucky schrieb:
[quoted text, click to view] > hi,
> i got file which contains "----------------" in a line. the line only
> contains this data as a saperation. using regular expression i want to
> i detify the line contains that data and replace with spaces.
> if anyone has any idea,solution or link plz do share with me.
>
> thans in advt.
>
> Lucky
If the string is always the same, the same characters, and length, there is
no need for a Regular Expression. Regular Expressions look for patterns. You
are looking for a specific substring. Use String.Replace.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
[quoted text, click to view] "lucky" <tushar.n.patel@gmail.com> wrote in message
news:1129965164.826213.151160@g47g2000cwa.googlegroups.com...
> hi,
> i got file which contains "----------------" in a line. the line only
> contains this data as a saperation. using regular expression i want to
> i detify the line contains that data and replace with spaces.
> if anyone has any idea,solution or link plz do share with me.
>
> thans in advt.
>
> Lucky
>