Skip to content

REGEXP_INSTR ​

Return the index of the matching item.

Syntax ​

result = REGEXP_INSTR(input, pattern [, start [, reference]] [, flags])
input value

Specify the value against which the regular expression is matched.

pattern value

Specify the regular expression to be matched against the input.

The pattern value must be a constant string and cannot be a column reference.

start value

The position in the input from where the pattern match starts. The default start position is 1.

Yellowbrick does not support special meanings for negative start values.

The start values can be column references.

reference value

Specify which pattern match is of interest. The default value is 1.

The reference values can be column references.

flags value

Can be either i for case-insensitive or c for case-sensitive matching. Matching is case-sensitive by default.

The flags value must be a constant string and cannot be a column reference.

Return ​

If the pattern is matched, the function returns the position of the matching text item.

If the pattern is not matched, the function returns 0.

Example ​

premdb=> select season_name,REGEXP_INSTR(season_name,'-') from season where numteams=22;
 season_name | regexp_instr
-------------+--------------
 1992-1993   |            5
 1993-1994   |            5
 1994-1995   |            5
(3 rows)

Parent topic:SQL Operators and Pattern Matching Functions