regex - MySQL REGEXP Match / or End of Field -
i've got load of paths in mysql database (5.7.17-0ubuntu0.16.04.2) , user chooses selection of paths, want select paths , below, i've hit issue.
say user wants "/root/k" need select for:
a. /root/k% b. /root/k how can regexp match end of field or / ?
i've tried following:
original query:
where path regexp ('/root/k/|/root/j/j/') # works doesn't show items in path, ones below path regexp '/root/k[/\z]' # same above path regexp '/root/k(?=/|$)' # error 1139, repetition-operator invalid i've tried: regex match _ or end of string gives error 1139
any other suggestions?
there no support lookarounds, not \z anchor in mysql regex. may use normal capturing group:
where path regexp '/root/k(/|$)' it match
/root/k- literal char sequence(/|$)- either/or end of entry.
Comments
Post a Comment