如何将java正则表达式转换为mysql regex

时间:2021-03-15 19:05:52

I would like to push the regular expression evaluation down to a mysql database. Therefore I am looking for a way to transform a Java regular expression into a Mysql regular expression. Has anybody experience with such an issue?

我想把正则表达式的评估放到mysql数据库中。因此,我正在寻找一种将Java正则表达式转换为Mysql正则表达式的方法。有人有过这样的经历吗?

1 个解决方案

#1


3  

MySQL's support for regular expressions is rather limited. MySQL only has one operator that allows you to work with regular expressions. This is the REGEXP operator, which works just like the LIKE operator, except that instead of using the _ and % wildcards, it uses a POSIX Extended Regular Expression (ERE) - http://www.regular-expressions.info/posix.html#ere .

MySQL对正则表达式的支持相当有限。MySQL只有一个操作符允许您使用正则表达式。这是REGEXP操作符,它的工作方式与like操作符类似,只是使用了POSIX扩展正则表达式(ERE),而不是使用_和%通配符,而是使用POSIX扩展正则表达式(ERE)。

You can see a comparison of regexps here:

您可以在这里看到regexp的比较:

http://www.regular-expressions.info/refflavors.html

http://www.regular-expressions.info/refflavors.html

and see if you have anything in java that is not supported in MySQL.

看看是否有java中不支持MySQL的内容。

#1


3  

MySQL's support for regular expressions is rather limited. MySQL only has one operator that allows you to work with regular expressions. This is the REGEXP operator, which works just like the LIKE operator, except that instead of using the _ and % wildcards, it uses a POSIX Extended Regular Expression (ERE) - http://www.regular-expressions.info/posix.html#ere .

MySQL对正则表达式的支持相当有限。MySQL只有一个操作符允许您使用正则表达式。这是REGEXP操作符,它的工作方式与like操作符类似,只是使用了POSIX扩展正则表达式(ERE),而不是使用_和%通配符,而是使用POSIX扩展正则表达式(ERE)。

You can see a comparison of regexps here:

您可以在这里看到regexp的比较:

http://www.regular-expressions.info/refflavors.html

http://www.regular-expressions.info/refflavors.html

and see if you have anything in java that is not supported in MySQL.

看看是否有java中不支持MySQL的内容。