Home / Search/ Language Reference/ Functions/ Scalar Functions/ String Functions/has_any_index

has_any_index

The has_any_index function gets a match for an RE2 regular expression from a source string. Optionally, convert the has_any_indexed substring to the indicated type.

Syntax

    has_any_index( String, LookupArray )

Arguments

  • String: A string.
  • LookupArray: Array of scalar or literal expressions to look up. The value should be of type long, integer, double, decimal, string, or guid.

Results

Zero-based index position of the first item in LookupArray that is found in String. Returns -1 if none of the array items were found in the string or if LookupArray is empty.

Examples

  • has_any_index("this is an example", dynamic(['this', 'example'])) : first lookup found in input string
  • has_any_index("this is an example", dynamic(['not', 'example'])) : last lookup found in input string
  • has_any_index("this is an example", dynamic(['not', 'found'])) : no lookup found in input string
  • has_any_index("Example number 2", range(1, 3, 1)) : lookup array of integers
  • has_any_index("this is an example", dynamic([])) : empty lookup array