One of the newer VBScript functions, Replace, allows you to replace text within one string with other text. The simplest method for using this function is:
Response.Write Replace("This is a test", "test", "question")
This will replace the word 'test' with the word 'question'. It will find as many instances of the word 'test' as exist in the first string. However, this version will match case exactly. If you want to ignore case when you are matching text, you have to use a longer version of this function:
Response.Write Replace("This is a test", "test", "question", 1, -1, vbTextCompare)
The fourth argument specifies which character to start at, the –1 indicates how many instances of 'test' to match. A –1 is the default value that indicates the function should match all the instances in the string. The last argument, vbTextCompare, indicates that comparisons should be done without regard to case. If you want to do exact matching, use the vbBinaryCompare value in place of vbTextCompare.