From 2ffad3d4d3c821acb9ce52c0df5189b902849841 Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Thu, 14 Dec 2023 11:42:58 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E7=9A=84=E5=AD=97=E7=AC=A6=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/lexer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/lexer.cpp b/backend/src/lexer.cpp index 8fed0b8..c470e02 100644 --- a/backend/src/lexer.cpp +++ b/backend/src/lexer.cpp @@ -270,7 +270,7 @@ bool CommandShowLexer(const std::string &command, std::string &ISBN, bool CommandBuyLexer(const std::string &command, std::string &ISBN, int &quantity) { static std::basic_regex main_pattern( - R"(^ *buy +(?:\S{1,20}) +[0-9]{1,10} *$)", + R"(^ *buy +(?:[!-~]{1,20}) +[0-9]{1,10} *$)", std::regex_constants::optimize); if (std::regex_match(command, main_pattern)) { std::stringstream ss(command); @@ -302,7 +302,7 @@ bool CommandBuyLexer(const std::string &command, std::string &ISBN, */ // clang-format on bool CommandSelectLexer(const std::string &command, std::string &ISBN) { - static std::basic_regex main_pattern(R"(^ *select +(?:\S{1,20}) *$)", + static std::basic_regex main_pattern(R"(^ *select +(?:[!-~]{1,20}) *$)", std::regex_constants::optimize); if (std::regex_match(command, main_pattern)) { std::stringstream ss(command); @@ -336,7 +336,7 @@ bool CommandModifyLexer(const std::string &command, std::string &ISBN, std::string &name, std::string &author, std::string &keyword, double &price) { static std::basic_regex main_pattern( - R"(^ *modify(?: +-ISBN=(?:\S{1,20})| +-name=\"(?:[^\s"]{1,60})\"| +-author=\"(?:[^\s"]{1,60})\"| +-keyword=\"(?:[^\s"]{1,60})\"| +-price=[0-9]{1,10}(?:\.[0-9]+)?)+ *$)", + R"(^ *modify(?: +-ISBN=(?:[!-~]{1,20})| +-name=\"(?:[!#-~]{1,60})\"| +-author=\"(?:[!#-~]{1,60})\"| +-keyword=\"(?:[^\s"]{1,60})\"| +-price=[0-9]{1,10}(?:\.[0-9]+)?)+ *$)", std::regex_constants::optimize); if (std::regex_match(command, main_pattern)) { std::stringstream ss(command);