MySql 正则表达式测试 [英] MySql Regex Expression test
本文介绍了MySql 正则表达式测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要检查以 . 分隔的数字.或 : 或/
I need to check for the digits that are separated by a . or : or /
我试过这个:
select 'test text 30.3 " REGEXP '\d+[:./]\d+'
但是返回了 0
我在网上的正则表达式测试中尝试过,它似乎工作正常并且与30.3"匹配.不知道为什么它在 mysql 中不起作用
I tried it in regex test online and it seems to be working fine and matches the '30.3'. Not sure why it's not working in mysql
推荐答案
没有\d
在 MySQL 中,使用范围或 :digit:
:
There's no \d
in MySQL, use ranges or :digit:
:
SELECT 'test text 30.3' REGEXP '[[:digit:]]+[:./][[:digit:]]+'
这篇关于MySql 正则表达式测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文