VBScript Basics, Part 70 | RegExp (Test & Replace)


| VBScript (.vbs) Tutorial
Teaches you how to create a regular expression object, how to assign a pattern to that object, explains the other properties IgnoreCase and Global, and the methods Test and Replace.

| Code Example
Set reg = New RegExp
reg.Pattern = “your_pattern”
reg.IgnoreCase = False
reg.Global = False

‘returns True or False
reg.Test(“string to search for pattern in”)

‘returns entire string with the replaced text
reg.Replace(“string to search for pattern in”, “string to replace pattern”)

| Paypal Contribution