Jump to content
Sign in to follow this  
fRequEnCy

_ReplaceStringInFile Help

Recommended Posts

fRequEnCy

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.

CODE
$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")

Exit

Else

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

EndIf

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.