Skip to main content

Find-with-Regex-Test

Command Description

Try using a Regex to find a string, and return true if found, otherwise return false

Command Prototype

bRet = Regex.Test(sText,sPattern)

Parameter Description

ParameterRequiredTypeDefaultDescription
sTextTruestring""The string to be operated
sPatternTruestring""Regular expression

return

bRet,The variable used to save the output of the command.

Demo

TracePrint("----------------------Regular expression lookup test-------------------- ----") 
//-------------------------------------------------------------------------------
//[Remarks] Try to use regular expressions to find the string, if you can find it and return true, if you can't find it, return false.
//Input parameter 1:
// sText--A string to operate on.
//Input parameter 2:
// sPattern--regular expression.
//out parameters:
// bRet--The variable to which the output of the function call is saved.
//
//Command prototype: bRet=Regex.Test(sText,sPattern)
//-------------------------------------------------------------------------------
bRet=Regex.Test("UiBot123","\\d{3}")
TracePrint(bRet)