Visual Basic Script (VBScript) version 5 and later (current version is 5.6) has a very powerful RegExp engine that is accessible through COM. The engine supports all the bells and whistles of regular expressions incl. grouping, backreferences etc.
Having regular expressions available from LotusScript is great since it allows you to use it for validation on the client etc. Another great thing is that the VBScript component is installed by default (at least on Windows XP) so there’s no need to touch client machines.
The VBScript RegExp engine is accessed from LotusScript using COM using the CreateObject() method:
Dim regexp As Variant
Set regexp = CreateObject("VBScript.RegExp")
Once you have a RegExp object you will normally use a code snippet like the following to do simple pattern matching:
'declarations
Dim regexp As Variant
Dim rc As Integer
'create object
Set regexp = CreateObject("VBScript.RegExp")
'make pattern matching case insensitive
regexp.IgnoreCase = True
'set pattern
regexp.Pattern = |[1-9]+[0-9]* Failed|
'test pattern
rc = regexp.Test(|Backup job XYZ: 2 Failed, 0 Succeeded.|)
If rc = -1 Then
MsgBox "Match - backup failed..."
Else
MsgBox "No match - backup suceeded..."
End If
Further reading