Automation Engine Script Guide > Ordered by Function > Strings > STR_MATCH

STR_MATCH

Script Function: Compares two strings

Syntax

STR_MATCH(String1, String2, [Wildcard1], [Wildcard2])

Syntax

Description/Format

String1

Alphanumeric character string which should be compared
Format: script literal or script variable

String2

Alphanumeric character string which should be compared
Format: scriptA particular Automation Engine object type. literal or script variableA placeholder for a value within a script.  

Wildcard1

Character representing any character
Format: script literal or script variable
Default: "*"

Wildcard2

Character representing one character
Format: script literal or script variable
Default: "_"


Return code

"Y" - The two strings are identical
"N" - The two strings are not identical

Comments

This script functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,… checks if String2 is identical String1. Upper and lower case are distinguished (case-sensitive).

In String2 wildcard charactersThese are placeholders for characters when you specify filters. ? stands for exactly one character, * for any number of characters. may be used to form a comparison pattern. Generally "*" stands for any character and "_" for exactly one.

Other wildcard characters may be used and assigned to Wildcard1 and/or Wildcard2.

As of v11 of the Automation EngineThis component drives an Automation Engine system and consists of different types of server processes. the length of variables was changed.
Thus, if a variableIt stores or retrieves values dynamically at runtime. An individual Automation Engine object type. contains a blank, the check for a variable of length 0 will return the value "N", as this example would produce:

:SET&TEST# = GET_VAR(‚VARA.TEST‘,‘KEY_DOES_NOT_EXIST‘)
:SET&TRUE#=STR_MATCH(&TEST#,"")

Examples

The first example shows the output of the result "N" in the activation protocol.

:SET &RET# = STR_MATCH("UserInterface", "User-Interface")
:
PRINT &RET#

The second example uses a wildcard character for comparison. The result "Y" is output in the activation protocol.

:SET &RET# = STR_MATCH("UserInterface", "U*I*")
:
PRINT &RET#

The third example uses a wildcard character which is explicitly specified. The result "Y" is output in the activation protocol.

:SET &RET# = STR_MATCH("UserInterface", "User#", "#")
:
PRINT &RET#

The fourth example also includes a wildcard character. It stands for exactly one character. Therefore, the result is "N".

:SET &RET# = STR_MATCH("UserInterface", "User#",, "#")
:
PRINT &RET#

 

See also:

Script Elements - Strings
About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function

 


Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support

Copyright © 2016 Automic Software GmbH