@@ -149,23 +149,36 @@ int main(int argc, char** argv)
149149{
150150 std::string buildid;
151151 bool input = false ;
152- std::regex regexStr (" ^[0-9]{8}\\ .[0-9]+$" );
152+ std::regex regexStr1 (" ^[0-9]{8}\\ .[0-9]+$" );
153+ std::regex regexStr2 (" ^[0-9]{8}\\ .[0-9]+\\ .[A-F0-9a-f]+$" );
153154 std::smatch matchResult;
154155 for (int i = 1 ; i < argc; i++) {
155156 std::string inputData = argv[i];
156- if (std::regex_match (inputData, matchResult, regexStr)) {
157+ if (std::regex_match (inputData, matchResult, regexStr1)) {
158+ for (auto ele : matchResult) {
159+ buildid = ele;
160+ input = false ;
161+ }
162+ }
163+ if (std::regex_match (inputData, matchResult, regexStr2)) {
157164 for (auto ele : matchResult) {
158165 buildid = ele;
159166 input = false ;
160167 }
161168 }
162169 }
163170 while (buildid.empty ()) {
164- std::cout << " 请输入构建 ID(形如“20230927.33 ”的字符串):" << std::endl;
171+ std::cout << " 请输入构建 ID(形如“20240430.141.d4eea86078 ”的字符串):" << std::endl;
165172 std::string inputData;
166173 std::getline (std::cin, inputData);
167174
168- if (std::regex_match (inputData, matchResult, regexStr)) {
175+ if (std::regex_match (inputData, matchResult, regexStr1)) {
176+ for (auto ele : matchResult) {
177+ buildid = ele;
178+ input = true ;
179+ }
180+ }
181+ if (std::regex_match (inputData, matchResult, regexStr2)) {
169182 for (auto ele : matchResult) {
170183 buildid = ele;
171184 input = true ;
0 commit comments