search and replace text in a .txt file

xelior

Member
Joined
Aug 15, 2006
Messages
8
Programming Experience
Beginner
Hello,

I am new with VB.NET.
I want to search and replace some text in a .txt file.
For example:

In the textfile is the word #name#, this must be replaced by the name typed in a textbox in VB.NET.

I figured out how to put the text in a textfile but then it first cleans the whole file and places the text in the first line.

Can someone please help me?

Tnx
 
Sorry it's a bit late, but you know what they say... better late than never!

VB.NET:
Dim RegPattern As New System.Text.RegularExpressions.Regex("\w{5}-\w{5}-\w{5}-\w{5}-\w{5}")
 
 
YourString = RegPattern.Replace(YourString, The string you want to replace it with)




 
Back
Top