Skip to main content

Find-with-Regular-Expression

Command Description

Use a Regex to find a string, and return an array of found strings

Command Prototype

arrRet = Regex.Find(sText,sPattern)

Parameter Description

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

return

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

Demo

TracePrint("----------------------Regular expression search --------------------- ---") 
//-------------------------------------------------------------------------------
//[Remarks] Regular expression searches for strings and returns an array of found strings.
//Input parameter 1:
// sText--A string to operate on.
//Input parameter 2:
// sPattern--regular expression.
//out parameters:
// arrRet--The variable to which the output of the function call is saved.
//
//Command prototype: arrRet=Regex.Find(sText,sPattern)
//-------------------------------------------------------------------------------
arrRet=Regex.Find("UiBot2022","\\d{4}")
TracePrint(arrRet)