VBScript Basics, Part 72 | RegExp ( Submatches )

| VBScript (.vbs) Tutorial
Sometimes in order to match with something your pattern has to be bigger than you wanted, but with submatches you can group which parts of your bigger pattern you actually wanted.

| Code Example
Set reg = New RegExp
reg.Pattern = “your pattern(submatch 0)other stuff(submatch 1)”
reg.Global = True

For Each match In reg.Execute(“your string)
msgbox match.Submatches(0)
msgbox match.Submatches(1)

| Paypal Contribution