以数组的形式返回的结果
//截取两个字符中间的字符串
getTextBetweenCharacters(str, char1, char2) {
const regex = new RegExp(char1 + "(.*?)" + char2, "g");
let matches = str.match(regex);
if (matches) {
return matches.map((match) =>
match.replace(char1, "").replace(char2, "")
);
}
return [];
},