O.P. RE: VBScript & coding tips
Maybe you guys can help me out, I'm trying to make a vbscript that uses the replace method and pattern property to takes a user's input, move the first letter of each word to the end of the word, then add a couple letters. This is what I've got, but it moves the last letter of the second word to the start of the second word. I'm stumped on this. Its supposed to translate text into pig latin.
Dim Message
Dim Title
dim result
set shellobj = CreateObject("WScript.Shell")
Message = "test"
Title = "test"
result = InputBox(Message,Title,"test", 2000, 2000)
Function ReplaceTest(patrn, replStr)
Dim regEx, str1
str1 = result
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
ReplaceTest = regEx.Replace(str1, replStr)
End Function
MsgBox(ReplaceTest("(\s+)(\S+)(\S+)", "$1$3$2") + "ay")
|