1
我已经在MySQL数据库(5.7.17-0ubuntu0.16.04.2)中加载了路径,并且用户选择了路径选择,我想选择所有这些路径和下面的,但我遇到了一个问题。MySQL REGEXP Match/or End of Field
假定用户要“/根/ K”我需要为做一个选择:
a. /root/K%
b. /root/K
我怎样才能获得REGEXP到现场或/结束匹配吗?
我已经试过如下:
原始查询:
where path REGEXP ('/root/K/|/root/J/J/') # this works but doesn't show the items in that path, only ones below
where path REGEXP '/root/K[/\z]' # does the same as above
where path REGEXP '/root/K(?=/|$)' # Get error 1139, repetition-operator invalid
我也试过:Regex to match _ or end of string但给人错误1139
任何其他建议?
完成,谢谢你的帮助。 – trevrobwhite