我正在使用RegEx尝试获取两个捕获组之间的内容。我要分析的参考文字是:
[UnityCrossThreadLogger]1/8/2019 7:49:19 PM
<== Log.Info(111)
True
[UnityCrossThreadLogger]1/8/2019 7:49:19 PM
==> Deck.GetDeckLists(112):
{
"jsonrpc": "2.0",
"method": "Deck.GetDeckLists",
"params": {},
"id": "112"
}
[UnityCrossThreadLogger]1/8/2019 7:49:19 PM
<== Deck.GetDeckLists(112)
[
{
"id": "a6386cf1-411b-4e41-8c1e-11ed423ddc1a",
"name": "?=?Loc/Decks/Precon/Precon_Blue",
"name": "Cancroni Gamberoni",
"description": "Decks/Precon/Precon_July_U",
"format": "",
"resourceId": "00000000-0000-0000-0000-000000000000",
"deckTileId": 67256,
"mainDeck": [
{
"id": "67256",
"quantity": 1
},
{
"id": "67794",
"quantity": 3
},
{
"id": "68212",
"quantity": 25
},
{
"id": "68150",
"quantity": 4
},
{
"id": "68144",
"quantity": 1
},
{
"id": "67772",
"quantity": 3
},
{
"id": "67818",
"quantity": 1
},
{
"id": "67770",
"quantity": 2
},
{
"id": "67822",
"quantity": 2
},
{
"id": "66451",
"quantity": 2
},
{
"id": "68156",
"quantity": 2
},
{
"id": "66739",
"quantity": 3
},
{
"id": "68136",
"quantity": 1
},
{
"id": "67208",
"quantity": 1
},
{
"id": "67780",
"quantity": 2
},
{
"id": "68300",
"quantity": 1
},
{
"id": "68256",
"quantity": 1
},
{
"id": "67240",
"quantity": 1
},
{
"id": "68164",
"quantity": 1
},
{
"id": "68298",
"quantity": 3
}
],
"sideboard": [],
"lastUpdated": "2018-08-31T20:29:12.4041434Z",
"lockedForUse": false,
"lockedForEdit": false,
"isValid": false
},
{
"id": "16e4b925-fb8e-42f0-9fb8-bfc36bdf235a",
"name": "?=?Loc/Decks/Precon/Precon_White",
"description": "Decks/Precon/Precon_July_W",
"format": "",
"resourceId": "00000000-0000-0000-0000-000000000000",
"deckTileId": 68250,
"mainDeck": [
{
"id": "68250",
"quantity": 1
},
{
"id": "67726",
"quantity": 1
},
{
"id": "66677",
"quantity": 1
},
{
"id": "68786",
"quantity": 1
},
{
"id": "67706",
"quantity": 1
},
{
"id": "68164",
"quantity": 1
},
{
"id": "69108",
"quantity": 1
},
{
"id": "69110",
"quantity": 1
},
{
"id": "68767",
"quantity": 1
},
{
"id": "67700",
"quantity": 2
},
{
"id": "67718",
"quantity": 2
},
{
"id": "67728",
"quantity": 2
},
{
"id": "67162",
"quantity": 2
},
{
"id": "67170",
"quantity": 2
},
{
"id": "68252",
"quantity": 2
},
{
"id": "67760",
"quantity": 2
},
{
"id": "66641",
"quantity": 3
},
{
"id": "67742",
"quantity": 3
},
{
"id": "67756",
"quantity": 3
},
{
"id": "68769",
"quantity": 3
},
{
"id": "68204",
"quantity": 25
}
],
"sideboard": [],
"lastUpdated": "2018-08-24T23:27:13.5934964Z",
"lockedForUse": false,
"lockedForEdit": false,
"isValid": false
}
]
[UnityCrossThreadLogger]1/8/2019 7:49:19 PM
==> Deck.GetDeckLists(112):
{
"jsonrpc": "2.0",
"method": "Deck.GetDeckLists",
"params": {},
"id": "112"
}
我的RegEx表达式是:(Deck.GetDeckLists\([\d]+\)(\n|\r|\r\n)\[)(.*)(}(\n|\r|\r\n)(\n|\r|\r\n)])
,RegexOptions.Singleline
有效(?s)。我的问题是使用https://regex101.com/r/rthrUt/1/和https://regexr.com/4642o之类的网站,它显示正确的捕获文本,但是在C#中使用相同的RegEx会从起点(Deck.GetDeckLists(112)
)返回所有内容。
我在做错什么吗?