Jump to content
Sign in to follow this  

_ReplaceStringInFile Help

Recommended Posts


What I'm trying to do is read from a txt file and write a Regular Expression to fix as follows

What I have now is:

File1 File Name1

File2 File Name2

What I want is:

File1|File Name1

File2|File Name2

This is just an example.

$file = "C:\somefile.txt"

$find = "(\w \s* \w)"

$replace = "|"

;Return Value

$retvalue = _ReplaceStringInFile($file, $find, $replace, 0, 1)

If $retvalue = -1 Then

MsgBox(0, "Error", "Pattern could not be found")



MsgBox(0, "Info", "Pattern found")


Please assist. Sorry for such a noob question but couldn't figure this out for nothing.

Edited by fRequEnCy

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this