ReadAllText and reading a textfile into a string

I want to read a textfile into a string. The problem is that I need a CrLf character at the end of each line.
Frans_TruyensAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
It is supposed to be already there if it is in your source file.
Frans_TruyensAuthor Commented:
I read a large file, >150 Mega, with ReadAllText. This file is a .txt file, with linebreaks. Then  I am using Regex to find the lines that start with STOP. There are multiple lines that start with STOP. But it will only find the first one. It is not an error of Regex, but just, the result is only one line.
Frans_TruyensAuthor Commented:
I know I can use a StreamReader, but that is rather slow. I want ReadAllText, but that it keeps the linebreakw. StreamReader is just too slow;
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Éric MoreauSenior .Net ConsultantCommented:
Any reason to load such a big file all at once?

Have you tried your regex on a much smaller file? Might be a buffer overrun with the regex.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Frans_TruyensAuthor Commented:
I am searching those files.
Frans_TruyensAuthor Commented:
It has to do with the end of line characters. Or I presume that that is the problem. Because if I look for a string inside the file, on any position, it works. Only if I am looking for leading strings, I have that problem
Frans_TruyensAuthor Commented:
I found it myself. It is required to use the option 'multiline', and then it works. Thanks for your time.
Éric MoreauSenior .Net ConsultantCommented:
On which object that multiline option?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.