From bd5c205b0a7c88b8fd0dfec73a430f9a31079896 Mon Sep 17 00:00:00 2001 From: 20220007 <20220007@edu.com> Date: Sun, 7 Apr 2024 10:00:03 +0800 Subject: [PATCH] ADD file via upload --- beanshell.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 beanshell.txt diff --git a/beanshell.txt b/beanshell.txt new file mode 100644 index 0000000..c7b8253 --- /dev/null +++ b/beanshell.txt @@ -0,0 +1,29 @@ +import java.util.regex; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.Base64; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +String t_path = vars.get("path"); +String answer = vars.get("t_content"); +log.info("*********************这是调试日志*************************************", t_path); + + +t_path = t_path.split(";")[0]; + +String pattern = ".*```.*?\n(.*)```.*"; +Pattern r = Pattern.compile(pattern, Pattern.DOTALL); +Matcher m = r.matcher(answer); +if(m.find()) { + answer = m.group(1); + log.info("-----日志^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"+ answer); +}else{ + answer = "not found***"; +} +String answerInJson = JSON.toJSONString(answer); +vars.put("answer", answerInJson); + +vars.put("t_path", t_path); +