Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql regexp简单_Mysql_Regex - Fatal编程技术网

Mysql regexp简单

Mysql regexp简单,mysql,regex,Mysql,Regex,我想得到所有的线,根据模式 xxx.xxx(仅限) 其中x是从1到9的数字或任何字母 我的表达式不起作用REGEXP'[a-z]{1,3}\.[a-z]{1,3}' 谢谢 UPD:Thx的所有,但不工作! 我试着这么做 SELECT email, registered, voted, ip, agent FROM `voters` WHERE member =199 AND DATE_FORMAT( voted, '%Y-%m-%d' ) < '2014-09-23' AND SU

我想得到所有的线,根据模式 xxx.xxx(仅限) 其中x是从1到9的数字或任何字母

我的表达式不起作用
REGEXP'[a-z]{1,3}\.[a-z]{1,3}'

谢谢

UPD:Thx的所有,但不工作! 我试着这么做

SELECT email, registered, voted, ip, agent
FROM  `voters` 
WHERE member =199
AND DATE_FORMAT( voted,  '%Y-%m-%d' ) <  '2014-09-23'
AND SUBSTRING_INDEX( email,  '@', 1 ) 
REGEXP  '[a-zA-Z1-9]{3}\.[a-zA-Z1-9]{3}'
UPD2:Itryed更改模式,因此
'[a-zA-Z1-9]{3}[\.]{1}[a-zA-Z1-9]{3}'
结果:


不好,因为“.”前后有3个以上的符号。

[a-z]
只匹配小写字母。您需要指定大写字母,也需要指定数字1-9

并且量词应该被修改<代码>{1-3}匹配前面模式的1到3倍。使用
{3}
匹配3次

REGEXP  '[a-zA-Z1-9]{3}\.[a-zA-Z1-9]{3}'
应该是

[a-zA-Z1-9]{3}\.[a-zA-Z1-9]{3}
只允许周期两侧有3个


和你说的任何字母。

如果你想要三个字母或数字后跟一个点,后跟三个条件相同的字符,前后不多,那么你必须使用

REGEXP '^[a-zA-Z1-9]{3}\.[a-zA-Z1-9]{3}$'
特殊字符
^
$
具有以下含义:

character     meaning
----------------------------------------------
    ^         Match the beginning of a string.
    $         Match the end of a string.

请尝试
[a-zA-Z1-9]{3,}\.[a-zA-Z1-9]{3,}
不起作用,只传递了3个符号和几个”
REGEXP '^[a-zA-Z1-9]{3}\.[a-zA-Z1-9]{3}$'
character     meaning
----------------------------------------------
    ^         Match the beginning of a string.
    $         Match the end of a string.