REGEXP_MATCH()
function matches a POSIX regular expression pattern to a string. It returns an array of TEXT[]
type with substring(s) of matched groups within the first match.
REGEXP_MATCH()
function is as follows:
source_string
: string on which you want to perform the matchingpattern
: POSIX regular expression pattern to matchflags
: (optional) string with flags that change the matching behavior of REGEXP_MATCH()
functionflags
parameter is an optional string that controls how the function operates. Here is a list of flags that are supported by Oxla:
i
: use this flag for case-insensitive matchingc
: REGEXP_MATCH()
function is case sensitive by default, using the c
flag has the same effect as having no flags at allci
flags, the regex will be case-insensitive, while using the ic
flags it will be case-sensitiveREGEXP_MATCH()
function can capture multiple groups within a match, which allow you to extract key parts from a string in a structured way. The example below extracts the protocol, domain and path from a given URL:
users
table are valid. If the regex doesn’t match, a NULL
value is returned.
NULL
if it cannot match the regular expression patterni
and c
flags shouldn’t be used with each other