find - UDM Command

Syntax

find string seq=sequence [pos=index] [case=yes|no] [num=number|last]

Description

The find command finds a specific occurrence of a substring in an existing string or list element.

The first parameter, string, is the string in which to search for the sequence. It can be a variable reference or a literal. The seq parameter specifies the sequence for which the search is being made.

The optional pos parameter specifies the one-based index of the string where the find operation begins.

The optional case parameter indicates whether the search is case-sensitive (yes) or case-insensitive (no). Default = no.

The optional num parameter specifies the instance of the sequence for which the search is being made. If the value of num is last, the find function gives back the index of the last occurrence of the sequence in the string.

If the sequence is found, the index (one-based) of the starting point of the requested occurrence is place in the _lastrc.result variable. If the sequence was not found in the string, a value of -1 is placed in the _lastrc.result variable.

If the sequence is found, _lastrc.message contains a value of MATCH. If the sequence could not be found, _lastrc.message contains NO_MATCH.

Parameters

Parameter

Description

string

String in which to search for the sequence.

seq=sequence

Sequence for which the search is being made.

pos=index

One-based index of the string where the find operation begins.

case=yes | no

Specification of whether the search is case-sensitive (yes) or case-insensitive (no).

Default is no.

num=number | last

Instance of the sequence for which the search is being made.

Examples


The following examples demonstrate the find command: