diff --git a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue index a822eeb..4a4fa2d 100644 --- a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue +++ b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue @@ -550,17 +550,12 @@ export default { return false; }, processString(input) { - // 正则表达式:匹配最多三位数字 - const regex = /^(\d{1,3})/; - - // 测试字符串是否以数字开头 - const match = input.match(regex); - - if (match) { - // 如果匹配,去掉开头的数字并返回剩余部分 - return input.substring(match[0].length + 1).trim(); - } + // 正则表达式: + const regexs = [/[0-9]+[.)]/, /(\d+分)/]; + regexs.forEach((regex) => { + input = input.replace(regex, ""); + }); // 如果没有匹配,直接返回原字符串 return input; }, diff --git a/src/views/basic/askTestQuestion/wrongQuestion.vue b/src/views/basic/askTestQuestion/wrongQuestion.vue index ee34d73..8256ba7 100644 --- a/src/views/basic/askTestQuestion/wrongQuestion.vue +++ b/src/views/basic/askTestQuestion/wrongQuestion.vue @@ -592,17 +592,12 @@ export default { this.getClassList(); }, processString(input) { - // 正则表达式:匹配最多三位数字 - const regex = /^(\d{1,3})/; - - // 测试字符串是否以数字开头 - const match = input.match(regex); - - if (match) { - // 如果匹配,去掉开头的数字并返回剩余部分 - return input.substring(match[0].length + 1).trim(); - } + // 正则表达式 + const regexs = [/[0-9]+[.)]/, /(\d+分)/]; + regexs.forEach((regex) => { + input = input.replace(regex, ""); + }); // 如果没有匹配,直接返回原字符串 return input; },