use utils::strmatch instead of strchr
This commit is contained in:
@ -130,7 +130,7 @@ void KimQuery::command(int narg, char **arg)
|
|||||||
|
|
||||||
// check the query_args format (a series of keyword=value pairs)
|
// check the query_args format (a series of keyword=value pairs)
|
||||||
for (int i = 2; i < narg; ++i) {
|
for (int i = 2; i < narg; ++i) {
|
||||||
if (!strchr(arg[i], '=') || !strchr(arg[i], '[') || !strchr(arg[i], ']')) {
|
if (!utils::strmatch(arg[i], "[=][\\[].*[\\]]")) {
|
||||||
auto msg = fmt::format("Illegal query format.\nInput argument "
|
auto msg = fmt::format("Illegal query format.\nInput argument "
|
||||||
"of `{}` to 'kim query' is wrong. The query format is the "
|
"of `{}` to 'kim query' is wrong. The query format is the "
|
||||||
"keyword=[value], where value is always an array of one or "
|
"keyword=[value], where value is always an array of one or "
|
||||||
|
|||||||
Reference in New Issue
Block a user