fix(接口测试): 修复正则提取模版问题

--bug=1037331 --user=赵勇 【接口测试】定义-调试-后置-快速提取中正则匹配结果模式不一样但结果相同 https://www.tapd.cn/55049933/s/1477611
This commit is contained in:
fit2-zhao 2024-03-19 16:18:02 +08:00 committed by Craftsman
parent 8cfa6c3499
commit b210957535
2 changed files with 5 additions and 4 deletions

View File

@ -36,8 +36,8 @@ public class RegexExtractConverter extends ExtractConverter<RegexExtract> {
private String getTemplate(String expressionMatchingRule) {
// $1$提取 JSON 响应中的第一个匹配项 $0$用于提取整个 JSON 响应
HashMap<String, String> ruleValueMap = new HashMap<>() {{
put(RegexExtract.ExpressionRuleType.EXPRESSION.name(), "$1$");
put(RegexExtract.ExpressionRuleType.GROUP.name(), "$0$");
put(RegexExtract.ExpressionRuleType.EXPRESSION.name(), "$0$");
put(RegexExtract.ExpressionRuleType.GROUP.name(), "$1$");
}};
if (StringUtils.isBlank(expressionMatchingRule)) {
return ruleValueMap.get(RegexExtract.ExpressionRuleType.EXPRESSION.name());

View File

@ -1,7 +1,8 @@
<template>
<MsDrawer
v-model:visible="innerVisible"
:width="680"
:width="720"
:show-full-screen="true"
:title="t('apiTestDebug.fastExtraction')"
disabled-width-drag
@confirm="emit('apply', expressionForm)"
@ -234,7 +235,7 @@
if (matchesIterator) {
const matches = Array.from(matchesIterator);
try {
if (expressionForm.value.expressionMatchingRule === 'expression') {
if (expressionForm.value.expressionMatchingRule === 'EXPRESSION') {
//
matchResult.value = matches.map((e) => e[0]) || [];
} else {