0
"foo" {
foo = "bar"
foo2 = "bar2"
foo3 = "bar3"
foo4 = "bar4"
id = "1"
foo5 = "bar5"
}
"foo" {
foo = "bar"
foo2 = "bar2"
foo3 = "bar3"
foo4 = "bar4"
id = "2"
foo5 = "bar5"
}
"foo" {
foo = "bar"
foo2 = "bar2"
foo3 = "bar3"
foo4 = "bar4"
id = "3"
foo5 = "bar5"
}
...
我的正則表達式通過它們的ID選擇此表項,但它也能夠選擇任何前進他,當我需要它時首先停止「}」被發現。我不知道如何防止這種情況。正則表達式的幫助,需要刪除「表」項
我的正則表達式是:/^"(?P<title>[^"]*)"[^{]*{(?=(.*))(?=[^}]*\sid\s*=\s+"2"[^}])/ixsmg
https://regex101.com/r/xA9kG3/26
哦,上帝,它已經爲你爲我如此簡單,所以並不明顯..謝謝,克里斯! – KAYOver
'ixsmg':使用世界上所有的修飾符不會增加你找到好模式的機會。 –