修改了更多的字符集

This commit is contained in:
2023-12-14 11:42:58 +00:00
parent 5cc26adbfc
commit 2ffad3d4d3

View File

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