Function ExecRegExpr(RegExpr As String, InputStr As String) As Boolean Dim re As pcre Ptr Dim error_ As ZString Ptr Dim erroffset As Integer Dim rc As Integer Dim OVECCOUNT As Const UInteger = 30 '' should be a multiple of 3 Dim ovector(OVECCOUNT-1) As Integer
re = pcre_compile( RegExpr, 0, @error_, @erroffset, NULL ) If re = NULL Then Print "pcre compilation failed at offset "; Str(erroffset); ": "; *error_ Sleep End End If
rc = pcre_exec( re, NULL, InputStr, Len( InputStr ),0, 0, @ovector(0), OVECCOUNT ) If rc < 0 Then Select Case rc Case pcre_error_nomatch 'Print "no match" Case Else 'Print "matching error"; rc End Select ExecRegExpr=FALSE Else ExecRegExpr=TRUE End If End Function