从正则表达式中得到错误“无效的重复计数" [英] Got error 'invalid repetition count(s)' from regexp

查看:125
本文介绍了从正则表达式中得到错误“无效的重复计数"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 mysql 中遇到以下错误:

I got the following error in mysql:

Got error 'invalid repetition count(s)' from regexp

我的查询是:

SELECT * FROM table WHERE some_text_field REGEXP"[A-Za-z0-9]{256}"

但是当我将 REGEXP"[A-Za-z0-9]{256}" 替换为 REGEXP"[A-Za-z0-9]{255}" 时代码>和下面没有错误.

But when I replace REGEXP"[A-Za-z0-9]{256}" with REGEXP"[A-Za-z0-9]{255}" and below there is no error.

REGEXP 中是否有字符限制?为什么我用256及以上的就不行,换成255及以下的就可以了?

Is there any character limitation in REGEXP? Why does it not work when I use 256 or above but works when I replace it with 255 or below?

我调查了这个,Mysql 在 Regex 上抛出异常,但它不是关于错误发生原因的信息非常丰富.

I looked into this, Mysql throwing exception on Regex, but it is not very informative on why the error is occurring.

推荐答案

Regular 下所述表达式:

更准确地说,a{n}an 个实例完全匹配.a{n,} 匹配 n 或多个 a 实例.a{m,n} 匹配 mna 实例,包括在内.

To be more precise, a{n} matches exactly n instances of a. a{n,} matches n or more instances of a. a{m,n} matches m through n instances of a, inclusive.

mn 必须在 0RE_DUP_MAX(默认为 255)的范围内,包括端点.如果同时给出 mnm 必须小于或等于 n.

m and n must be in the range from 0 to RE_DUP_MAX (default 255), inclusive. If both m and n are given, m must be less than or equal to n.

这篇关于从正则表达式中得到错误“无效的重复计数"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆