Hello all,
I have been searching these threads for a script to format a list i have in a text file. The text is formatted as
3RD AND THE MORTAL, THE\MEMOIRS
What I wold like is
MEMOIRS\3RD AND THE MORTAL, THE
I have this script which i used for a names list, but I do not know how to change it to reflect the new text.
Dim FSO, objFile, RegEx, strDestin, strFile, strSource
Set FSO = CreateObject("Scripting.FileSystemObject")
Set RegEx = New RegExp
RegEx.Global = True
RegEx.Pattern = "^([^,]*), (.*)$"
Const ForReading = 1
strSource = "c:\A.txt"
strDestin = "c:\A.txt"
Set objFile = FSO.OpenTextFile(strSource, ForReading)
strFile=""
if not objFile.atendofstream then
strFile = objFile.ReadAll
end if
objFile.Close
dim a
a=split(strFile,vbcrlf)
for i=0 to ubound(a)
a(i)=RegEx.Replace(a(i), "$2 $1")
next
Set objFile = FSO.CreateTextFile(strDestin, True)
objFile.Write join(a,vbcrlf)
objFile.Close
Any help would be most appreciated.
TIA,
AL
I have been searching these threads for a script to format a list i have in a text file. The text is formatted as
3RD AND THE MORTAL, THE\MEMOIRS
What I wold like is
MEMOIRS\3RD AND THE MORTAL, THE
I have this script which i used for a names list, but I do not know how to change it to reflect the new text.
Dim FSO, objFile, RegEx, strDestin, strFile, strSource
Set FSO = CreateObject("Scripting.FileSystemObject")
Set RegEx = New RegExp
RegEx.Global = True
RegEx.Pattern = "^([^,]*), (.*)$"
Const ForReading = 1
strSource = "c:\A.txt"
strDestin = "c:\A.txt"
Set objFile = FSO.OpenTextFile(strSource, ForReading)
strFile=""
if not objFile.atendofstream then
strFile = objFile.ReadAll
end if
objFile.Close
dim a
a=split(strFile,vbcrlf)
for i=0 to ubound(a)
a(i)=RegEx.Replace(a(i), "$2 $1")
next
Set objFile = FSO.CreateTextFile(strDestin, True)
objFile.Write join(a,vbcrlf)
objFile.Close
Any help would be most appreciated.
TIA,
AL