【发布时间】:2023-01-03 02:33:41
【问题描述】:
我有很多 json 文件和内部标签,比如
actions:
- name: email
template: email_exp_csr_008
schedule:
week: false
workdays: true
persistent: true
我需要在接下来的 3 行中找到“schedule:”未跟在“workdays:”之后的情况。上面的例子不应该匹配,但这个应该:
actions:
- name: email
template: email_exp_csr_008
schedule:
week: false
persistent: true
werwer: True
我这样试过
schedule:(.*\n){0,3}.*[^(workdays)]
但它并不能解决问题。有人可以帮忙吗?
【问题讨论】:
-
我删除了 JS 标签并添加了 yaml。如有需要请重新标记
-
请指定您要使用哪种语言通过正则表达式解析 YAML(正则表达式风格因语言/引擎而异)。根据语言的不同,我们也可能会建议更好的工具来解决您的任务。