Jump to content

Recommended Posts

Posted (edited)

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...