Regular Expressions in MariaDB

MariaDB Regular Expressions
Regular expression-based matching is possible in MariaDB through the REGEXP Operator.

Syntax:

expression REGEXP pattern

 

Parameters:

expression: It is used to specify a character expression such as a column or field.

pattern: It is used to specify the regular expression matching information. The value of the pattern can be:

 

VALUEUSES
^To match the beginning of a string.
$To match the end of a string.
*To match zero or more occurrences.
+To match one or more occurrences.
?To match zero or one occurrence.
.To match any character except null.
|To specify more than one alternative.
[ ]To specify a matching list to match any one of the characters in the list.
[^ ]To specify a non matching list to match any character except for the ones in the list.
( )To group expressions as a subexpression.
{m}To match m times.
{m,}To match at least m times.
{m,n}To match at least m times, but no more than n times.
\nTo match the nth subexpression found within ( ) before encountering \n, where n is a number between 1 and 9.
[..]To match one collation element that can be more than one character.
[::]To match character classes.
[==]To match equivalence classes.
\dTo match a digit character.
\dTo match a non-digit character.
\wTo match a word character.
\wTo match a non-word character.
\sTo match a whitespace character.
\sTo match a non-whitespace character.
*?To match the preceding pattern zero or more occurrences.
+?To match the preceding pattern one or more occurrences.
??To match the preceding pattern zero or one occurrence.
{n}?To match the preceding pattern n times.
{n,}?To match the preceding pattern at least n times.
{n,m}?To match the preceding pattern at least n times, but not more than m times.

 

Content Protection by DMCA.com
Please Share