我需要一个正则表达式来处理不同的终端条件,我的想法是这样的,但它不起作用
re.findall(r'(?<=tests\[")(.*)((?="\])|(?=:)', input_string])
输入格式如下:
tests["Status code: " +responseCode.code] = responseCode.code === 200;
tests["Schema validator GetTerminalInitEventForHarewareIds"] = tv4.validate(data, schema);
说明
此正则表达式将执行以下操作:
tests["
开头示例
现场演示
https://regex101.com/r/oE9lL6/3
示例文本
样本匹配
: "
结尾,后跟非]
,则不包括:
和尾随文本: "]
结尾,则:
和尾随空格将包括在内解释
相关问题 更多 >
编程相关推荐