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); +