## Regular Expression Functions and Operators 

•Regular Expression Functions and Operators 

•Regular Expression Syntax 

•Regular Expression Resource Control 

•Regular Expression Compatibility Considerations 

• expr  NOT REGEXP pat , expr  NOT RLIKE pat 

This is the same as NOT ( expr  REGEXP pat ) . 

• expr  REGEXP pat , expr  RLIKE pat 

Returns 1 if the string expr  matches the regular expression specified by the pattern pat , 0 otherwise. If expr  or pat  is NULL , the return value is NULL . 

REGEXP  and RLIKE  are synonyms for REGEXP_LIKE() . 

For additional information about how matching occurs, see the description for REGEXP_LIKE() . 

mysql> SELECT ’Michael!’ REGEXP ’.*’; +------------------------+ | ’Michael!’ REGEXP ’.*’ | +------------------------+ | 1 | +------------------------+ mysql> SELECT ’new*
*line’ REGEXP ’new\\*.\\*line’; +---------------------------------------+ | ’new*
*line’ REGEXP ’new\\*.\\*line’ | +---------------------------------------+ | 0 | +---------------------------------------+ mysql> SELECT ’a’ REGEXP ’^[a-d]’; +---------------------+ | ’a’ REGEXP ’^[a-d]’ | +---------------------+ | 1 | +---------------------+ mysql> SELECT ’a’ REGEXP ’A’, ’a’ REGEXP BINARY ’A’; +----------------+-----------------------+ | ’a’ REGEXP ’A’ | ’a’ REGEXP BINARY ’A’ | +----------------+-----------------------+ | 1 | 0 | +----------------+-----------------------+ 

• REGEXP_INSTR( expr , pat [, pos [, occurrence [, return_option [, match_type ]]]]) 

Returns the starting index of the substring of the string expr  that matches the regular expression specified by the pattern pat , 0 if there is no match. If expr  or pat  is NULL , the return value is NULL . Character indexes begin at 1. 

REGEXP_INSTR()  takes these optional arguments: 

• pos : The position in expr  at which to start the search. If omitted, the default is 1. 

• occurrence : Which occurrence of a match to search for. If omitted, the default is 1. 

