Eigenschaft "Multiline"

Boolescher Wert (True oder False), der angibt, ob die Anker ^ und $ dem Start und Ende jeder Zeile entsprechen.

Note:

Der Standardwert lautet "False".

Eigenschaftsverwendung:

Syntax: Object.Multiline = "<True/False>"

Beispiel:

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

Wenn "Multiline" aktiviert ist, verhalten sich ^ und $ unterschiedlich und entsprechen dem Anfang und dem Ende jeder Zeile und nicht der gesamten Zeichenfolge. Da Multiline = True im obigen Beispiel angegeben ist, entspricht ^Hello sowohl "Hello, world!" als auch "Hello again!", da beide Zeilen mit "Hello" beginnen.