gpt4 book ai didi

Mysql 正则表达式返回零结果

转载 作者:行者123 更新时间:2023-11-29 10:37:40 25 4
gpt4 key购买 nike

这是我的查询,它确实有效:

select composition from `drugs` where composition regexp "^Diclofenac([^)])"

输出:

Diclofenac(50mg),Thiocolchicoside(8mg)                                              
Diclofenac(50mg),Thiocolchicoside(4mg)
Diclofenac(75mg),Thiocolchicoside(4mg)
Diclofenac(50mg),Thiocolchicoside(4mg)
Diclofenac(50mg),Tamsulosin(0.4mg)
Diclofenac(50mg),Eperisone(50mg)
Diclofenac(50mg),Thiocolchicoside(8mg)
Diclofenac(100mg),Rabeprazole(20mg)
Diclofenac(75mg)
Diclofenac(50mg),Thiocolchicoside(8mg)
Diclofenac(50mg),Serratiopeptidase(10mg)
Diclofenac(100mg),Eperisone(150mg)
Diclofenac(4mg),Thiocolchicoside(50mg)
Diclofenac(100mg),Eperisone(150mg)
Diclofenac(50mg),Thiocolchicoside(4mg)
Diclofenac(50mg),Thiocolchicoside(8mg)
Diclofenac(50mg),Nimesulide(100mg)
Diclofenac(50mg),Paracetamol(325mg),Thiocolchicoside(8mg)
Diclofenac(NA),Serratiopeptidase(NA)
Diclofenac(50mg),Nimesulide(100mg)
Diclofenac(50mg),Thiocolchicoside(4mg)
Diclofenac(50mg),Paracetamol(325mg),Thiocolchicoside(4mg)
Diclofenac(100mg),Rabeprazole(20mg)
Diclofenac(50mg),Serratiopeptidase(10mg)
Diclofenac(50mg),Nimesulide(100mg)

我想搜索其成分以双氯芬酸()开头,后跟“,”,然后是硫秋水仙苷()的药物。尝试以下但结果为零。

select composition from `drugs` where composition regexp "^Diclofenac([^)]),Thiocolchicoside([^)])"

编辑:创建数据库 fiddle :https://www.db-fiddle.com/f/fkQkn2WKdax2KbZqt7rPQ/0

最佳答案

select composition from `drugs` where composition regexp "^Diclofenac\\([^)]+\\),Thiocolchicoside\\([^)]+\\)$"

除了添加'+'来匹配多个非右大括号字符,即[^)],您还需要转义'(',因为它在正则表达式中具有特殊含义

关于Mysql 正则表达式返回零结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46127283/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com