Commit 2361d2d4ccd7fb351eab495eb308fc00202b99be
1 parent
22d8051e
feat: 代码提交
Showing
2 changed files
with
10 additions
and
20 deletions
src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
... | ... | @@ -550,17 +550,12 @@ export default { |
550 | 550 | return false; |
551 | 551 | }, |
552 | 552 | processString(input) { |
553 | - // 正则表达式:匹配最多三位数字 | |
554 | - const regex = /^(\d{1,3})/; | |
555 | - | |
556 | - // 测试字符串是否以数字开头 | |
557 | - const match = input.match(regex); | |
558 | - | |
559 | - if (match) { | |
560 | - // 如果匹配,去掉开头的数字并返回剩余部分 | |
561 | - return input.substring(match[0].length + 1).trim(); | |
562 | - } | |
553 | + // 正则表达式: | |
554 | + const regexs = [/[0-9]+[.)]/, /(\d+分)/]; | |
563 | 555 | |
556 | + regexs.forEach((regex) => { | |
557 | + input = input.replace(regex, ""); | |
558 | + }); | |
564 | 559 | // 如果没有匹配,直接返回原字符串 |
565 | 560 | return input; |
566 | 561 | }, | ... | ... |
src/views/basic/askTestQuestion/wrongQuestion.vue
... | ... | @@ -592,17 +592,12 @@ export default { |
592 | 592 | this.getClassList(); |
593 | 593 | }, |
594 | 594 | processString(input) { |
595 | - // 正则表达式:匹配最多三位数字 | |
596 | - const regex = /^(\d{1,3})/; | |
597 | - | |
598 | - // 测试字符串是否以数字开头 | |
599 | - const match = input.match(regex); | |
600 | - | |
601 | - if (match) { | |
602 | - // 如果匹配,去掉开头的数字并返回剩余部分 | |
603 | - return input.substring(match[0].length + 1).trim(); | |
604 | - } | |
595 | + // 正则表达式 | |
596 | + const regexs = [/[0-9]+[.)]/, /(\d+分)/]; | |
605 | 597 | |
598 | + regexs.forEach((regex) => { | |
599 | + input = input.replace(regex, ""); | |
600 | + }); | |
606 | 601 | // 如果没有匹配,直接返回原字符串 |
607 | 602 | return input; |
608 | 603 | }, | ... | ... |