regex 将.NET正则表达式转换为PCRE2正则表达式以获取JSON的日期值[重复]

myzjeezk  于 2023-01-03  发布在  .NET
关注(0)|答案(1)|浏览(95)
    • 此问题在此处已有答案**:

What is the difference between a regular string and a verbatim string?(6个答案)
3天前关闭。
我有如下的JSON:

[{"step":1,"stepId":17,"nextStepId":18,"data":[{"title":"Role of Partner","content":null,"contentText":"Please select one","type":"dropdown","id":"field2step17"}],"status":"00-Draft"},{"step":2,"stepId":18,"nextStepId":42,"data":[{"title":"Product Line","content":["116"],"contentText":"International BD","type":"lookup","id":"field2step18"},{"title":"TEST Responsible Person","content":"John, Doe (external)","key":"i:0#.w|opmain\\xespsa","type":"people-picker","id":"field3step18"},{"title":"Deadline","content":"2023-01-04","type":"date","id":"field12step18"}],"status":"00-Draft"},{"step":3,"stepId":42,"nextStepId":19,"data":[],"status":"00-Draft"},{"step":4,"stepId":19,"nextStepId":21,"data":[],"status":"00-Draft"},{"step":5,"stepId":21,"nextStepId":null,"data":[{"title":"(iii) none of the above","content":"Yes","type":"radio","id":"field3step21"}],"status":"00-Draft"},{"step":6,"stepId":16,"nextStepId":null,"data":[{"title":"The partner’s role is limited to supporting TEST Group in tax, financial, accounting, legal or regulatory advisory services or related representations before government agencies, provided that:\nthe proposed Partner is a reputable legal, audit or accounting firm; and\nthe Partner’s role does not involve acting on behalf of TEST Group in the process of obtaining or retaining contracts (whether from government or private entities)","content":"Yes","type":"yes-no","id":"field1step16"}],"status":"00-Draft"},{"step":7,"stepId":39,"nextStepId":null,"data":[],"status":"00-Draft"}]

我使用这个正则表达式来获取Deadline(2023 - 01 - 04)的值

(?<=""title"":""(?i)Deadline""(?-i),""content"":"")[^""]+

但是,Regex仅适用于. NET。请参见https://regex101.com/r/GTudbU/1
我尝试更改以使其适用于PCRE2,但我不知道如何更改。
需要如何更改Regex才能适用于PCRE2?

2ul0zpep

2ul0zpep1#

删除正则表达式中的两个"
(?<="title":"(?i)Deadline"(?-i),"content":")[^"]+
https://regex101.com/r/GHJVFg/1

相关问题