To view the latest 11.3.x version, see PATROL Agent 11.3.02.

String Operators


PSL has special operators for string and list manipulation that are not found in C.

. (period)

The period indicates the concatenation of two strings.

"ab"."cd" is equal to "abcd"

[s1, s2, ...]

The list operator builds a list by joining all elements in a comma-separated list or array into a double-quoted string of items delimited by a new-line character. For example, ["a", "b", "c"] is equal to "a\nb\nc".

Warning

The list operator ignores the NULL string ( "" ). The ["a", "", "b"] list is equal to "a\nb", but not "a\n\nb". Use the new-line character to separate the members of a list if the list contains the NULL string.

=~ (equal tilde)

The = operator is used in the expression string = pattern and returns the following values:

  • 1 if the regular expression pattern is contained in string
  • 0 if the regular expression pattern is not contained in string

If pattern is invalid, PSL returns a run-time error message, and the =~{{/code}} operation returns 0 ( {{code language="none"}}pattern{{/code}} not contained).

== {{id name="StringOperators-!~~(tilde)"/}}!~~ (tilde) ==

The {{code language="none"}}!{{/code}},, operator is used in the expression {{code language="none"}}string !{{/code}},,{{code language="none"}} pattern{{/code}} and returns the following values:

* 1 if the regular expression {{code language="none"}}pattern{{/code}} is not contained in {{code language="none"}}string{{/code}}
* 0 if the regular expression {{code language="none"}}pattern{{/code}} is contained in {{code language="none"}}string{{/code}}

If {{code language="none"}}pattern{{/code}} is invalid, PSL returns a run-time error message and the {{code language="none"}}!~{{/code}} operation returns 0 ( {{code language="none"}}pattern{{/code}} contained).



== {{id name="StringOperators-Wheretogofromhere"/}}Where to go from here ==

[[doc:IT-Operations-Management.Operations-Management.BMC-PATROL-Agent.PA113.PATROL-Script-Language-overview-and-functions.PSL-Data-Types-and-Operators.PSL-Operators.WebHome]]

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*