Multiline Property
Boolean value (True or False) that specifies whether the ^ and $ anchors match the start and end of each line.
Note:
Default value is False.
Property Usage:
Syntax: Object.Multiline = "<True/False>"
Example:
Dim regEx, inputStr, result
Set regEx = CreateObject("VBScript.RegExp")
' Enable multiline mode
regEx.Multiline = True
' Pattern to match the beginning of each line
regEx.Pattern = "^Hello"
regEx.IgnoreCase = True
' Input string with multiple lines
inputStr = "Hello, world!" & vbCrLf & "This is a test." & vbCrLf & "Hello again!"
' Find all lines that start with "Hello"
result = regEx.Test(inputStr)
If result Then
'Logic Matches at the start of a line.
Else
'Logic Does not match at the start of any line.
End If
When Multiline is enabled, ^ and $ behave differently, matching the beginning and end of
each line rather than the whole string. Since Multiline = True
in above
example, ^Hello will match "Hello, world!" and "Hello again!", as both lines
begin with "Hello".