正则表达式解决方法无限重复内部回顾

Regex workaround infinite repetition inside lookbehind

我正在尝试匹配文本 value_to_match,在 Intellij 正则表达式搜索中,前面有一行 "attribute": "type" 并且(在某些时候)前面有 "marketTypeId": 123456789

在以下文本中,搜索应仅匹配 value_to_match

    {
      "marketTypeId": 123456789,
      "description": "Market description",
      "periodType": "MATCH",
      "periodInstance": 1,
      "feedMappingData": [
        {
          "outcomeIdFeedcodeMap": {
            "2": "123456789001",
            "1": "123456789002"
          },
          "conditions": [
            {
              "element": "Market",
              "attribute": "type",
              "condition": "EQUALS",
              "value": "value_to_match"
            },
            {
              "element": "Market",
              "attribute": "traded_pre_match",
              "condition": "EQUALS",
              "value": "true"
            }
          ]
        },
    {
      "marketTypeId": 12121212,
      "description": "Market description",
      "periodType": "MATCH",
      "periodInstance": 1,
      "feedMappingData": [
        {
          "outcomeIdFeedcodeMap": {
            "2": "12121212001",
            "1": "12121212002"
          },
          "conditions": [
            {
              "element": "Market",
              "attribute": "type",
              "condition": "EQUALS",
              "value": "value_NOT_to_match"
            },
            {
              "element": "Market",
              "attribute": "traded_pre_match",
              "condition": "EQUALS",
              "value": "true"
            }
          ]
        },

我一直在尝试对条件使用回顾,但 Intellij 正则表达式搜索似乎不支持回顾中的无限重复。 对于这种情况有什么解决方法吗?

使用 Intellij 和正后视

Intellij 中使用的正则表达式:

(?s)(?<="marketTypeId":\s123456789,.{1,500}"attribute":\s"type",.{1,100}"value":\s")value_to_match(?=")

注:

Dotall mode can also be enabled via the embedded flag expression (?s)

在参考资料中阅读有关此标志表达式和正则表达式外观的更多信息:

https://docs.oracle.com/javase/10/docs/api/java/util/regex/Pattern.html

使用 Intellij 版本 2020.2

Intellij图片及匹配:

可以在此处阅读有关 Intellij 和匹配的更多信息:

Is there a way with Regex to grab the first word and replace a quoted section?