DIAdem Help

Content Type
Programming Language
Current manual
Table of Contents

Method: Test for RegExp

Method: Test for RegExp

Searches, with a regular expression, in a character string an returns a Boolean value that specifies whether the character string contains the text pattern.

bTest = Object.Test(sourceString)
ObjectRegExp
Object with this method
sourceStringString
Specifies the character string you want to search through.
bTestBoolean
The method Test returns TRUE if the character string contains a text pattern. Otherwise the method returns FALSE.

The following example checks whether a given character string contains special characters:

Function FindSpecChar(sText)
  Dim RegExpression
  Set RegExpression = CreateObject("VBScript.RegExp") 
  RegExpression.Global = True 
  RegExpression.MultiLine = True 
  RegExpression.Pattern = "[^0-9a-zA-Z]" 
  If RegExpression.Test(sText) Then
    FindSpecChar = "Pattern exists"
  Else
    FindSpecChar = "Pattern doesn't exist"
  End If
End Function
In This Section
Was this information helpful?