Description\n-----------\n\nSyntax\n\n``sql\nREGEXP_INSTR(subject, pattern)\n`\n\nReturns the position of the first occurrence of the regular expression pattern in the string subject, or 0 if pattern was not found.\n\nThe positions start with 1 and are measured in characters (i.e. not in bytes), which is important for multi-byte character sets. You can cast a multi-byte character set to BINARY to get offsets in bytes.\n\nThe function follows the case sensitivity rules of the effective collation. Matching is performed case insensitively for case insensitive collations, and case sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i) PCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular expression performance, and REGEXP_INSTR` was introduced as part of this enhancement.\n\nExamples\n--------\n\nSELECT REGEXP_INSTR('abc','b');\n-> 2\n\nSELECT REGEXP_INSTR('abc','x');\n-> 0\n\nSELECT REGEXP_INSTR('BJÖRN','N');\n-> 5\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_instr