sorry about the title, but the stupid thing did not accept anything. I am triyng to do this
Dim myString, myResult
myString = \"Hello World! 1234 Hello World! 43
You can do this using a replacement function:
Function Reverse(m, pos, src)
Reverse = StrReverse(m)
End Function
Set re = New RegExp
re.Pattern = "\d+"
re.Global = True
s = "Hello World! 1234 Hello World! 4321 Hello World! 6789"
WScript.Echo re.Replace(s, GetRef("Reverse"))
Output:
Hello World! 4321 Hello World! 1234 Hello World! 9876
Just calling re.Replace(s, StrReverse("$1"))
won't work, because in this statement, StrReverse
reverses the string "$1" before re.Replace()
is called.