Covert button to Vbscript

I have a button that swaps lastname, firstname and i'm trying to convert it to a vbscript button either as a stand alone or to be inserted into the Title Case Plus ...the first example is what i'm using which works and the second example is what i'm trying to convert it to.

This is what i'm trying to convert

Rename REGEXP PATTERN="^(\w+), *([\w \.]+)[ ]+-[ ]*(.*)" TO="\2 \1 - \3" AUTORENAME
@nodeselect

this is whats not working as a stand alone button

RENAME FROM="*" TO="*"
@script vbscript
option explicit
Function Rename_GetNewName ( strFileName, strFullPath, fIsFolder, strOldName, ByRef strNewName )
		re.Pattern = "^(\w+), *([\w \.]+)[ ]+-[ ]*(.*)"
		strNewName = re.Replace(strNewName, "$2 $1 - $3")
End Function

for title case plus it strips the extension i was trying this and its not working either

	' Swap Last Name, First Name
	if fSwap = True then
		re.Pattern = "^(\w+), *([\w \.]+)[ ]+-[ ]*(.*)"
		strNewName = re.Replace(strNewName, "$2 $1 - $3")
	end if

any ideas?

I solved this one ...its for swaping firstname, lastname and multiples of it for anyone that needs

@NODESELECT RENAME TO="*" @script vbscript Option Explicit Function Rename_GetNewName ( strFileName, strFullPath, fIsFolder, strOldName, ByRef strNewName ) Dim re Set re = new RegExp re.IgnoreCase=True re.Global=True re.Pattern = "^(\w+), *([\w \.]+)[ ]+-[ ]*(.*)" strNewName = re.Replace(strNewName, "$2 $1 - $3") re.Pattern = "([^,]*), ([^&]*)& ([^,]*),([^-]*)-(.*)" strNewName = re.Replace(strNewName, "$2$1 &$4$3 -$5") re.Pattern = "([^,]*), ([^&]*)and ([^,]*),([^-]*)-(.*)" strNewName = re.Replace(strNewName, "$2$1 &$4$3 -$5") End Function