Skip to content

Instantly share code, notes, and snippets.

@JoJoJotarou
Created June 11, 2021 08:35
Show Gist options
  • Save JoJoJotarou/1544393180d40761968443764a07f511 to your computer and use it in GitHub Desktop.
Save JoJoJotarou/1544393180d40761968443764a07f511 to your computer and use it in GitHub Desktop.
mysql 正则表达式
# mysql取字符串中的数值(小数据需要保留)
# 正常写法:(?!\.)\D
# 解释:取出所有非数字的字符,不包括小数点
select regexp_replace('(12.0 -&dd放大21)', '(?!\\\.)\\D', '')
# 结果:12.021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment