SQL Flow Field Guide

REGEXP_INSTR

Catalog support for SQL Server 2025 (17.x)

regular expression evaluation

What changes

Input
string, regex pattern, flags
Output or change
match result, position, count or replaced text
Return type
int

Syntax at a glance

REGEXP_INSTR ( string_expression, pattern_expression [ , start [ , occurrence [ , return_option [ , flags [ , group ] ] ] ] ] )

Work example

Find the position of a matching segment before splitting or extracting text.

Set whether the result points to the match start or end and test repeated matches.

Check your work Position options change the returned index and no match uses a distinct result from a valid position.

Open Microsoft Learn for full syntax, permissions, and details for your version.