79812834

Date: 2025-11-07 22:30:56
Score: 1
Natty:
Report link

``


Sub CreateObject(ByRef StrText As String)
Print StrText
End Sub 

Type regex
     pattern As String
     IgnoreCase As Boolean
     Global As Boolean
     Test(0 To 100) As Integer 
End Type

Dim reg_xyz As Object
Call CreateObject("VBScript.RegExp")

Sub reg_xyz_event (ByRef regex As regex)

regex.Pattern = "pizza|coke|paste"
regex.IgnoreCase = True
regex.Global = True

End Sub

Dim testString As String
testString = "I want pizza and coke"

If regex.Test = 0 Then
    On Error Goto MessBox:
       Print "Error: "; 0; "Match found"
    End 

    MessBox:
      regex.Test += 1
    Resume Next     
Else
    Print MessBox; "Error: "; 0; "No match found"
End If
' ```

' 4. For simple string functions like Left and Right, you must assign or use the result:
' ```vb
Dim leftPart As String
leftPart = Left(pattern, 5) ' gets first 5 characters
Print leftPart
Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Denis Do Nascimento Veira