RegExp.Match (gb.pcre)
Static Function Match ( Subject As String, Pattern As String [ , CompileOptions As Integer, ExecOptions As Integer ] ) As Boolean
Sinds 3.5
This static method takes the same parameters as the
Regexp constructor does. However, is does not create a new object but instead it returns whether the subject matches the pattern.
It is handy for one-line string matching where the
LIKE keyword is not sophisticated enough:
Examples
Use "gb.pcre"
If RegExp.Match("Zebra1", "[a-zA-Z]*") Then
Print "Match"
Else
Print "No Match!"
EndIf
' This checks whether the text in a TextBox contains at least four identical
' characters in a row.
If Regexp.Match(TextBox1.Text, "([a-zA-z])\\1{3,}") Then
Error "I don't think this is a word."
Endif
Effectively, Regexp.Match() is a (slightly more efficient) short-hand for
Dim hTemp As New RegExp(sSubject, sPattern, iCompileOptions, iExecOptions)
Return hTemp.Offset <> -1