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);