0

I need to extract "https://www.domain3.com" from this JSON

{
    "jobs": [
        {
            "name": "alfa",
            "url": "https://www.domain1.com"
        },
        {
            "name": "beta_publish",
            "url": "https://www.domain2.com"
        },
        {
            "name": "gammma_release",
            "url": "https://www.domain3.com"
        }
    ]
}

using a regular expression.

I'm trying to use this one (in https://www.jsonquerytool.com/ ...),

$..jobs[?(@.name=~/release*?/i)].url

but it doesn't work, but if I try to use it in https://regex101.com/ it seems to work fine.

Any suggestion will be appreciated!

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Cesare
  • 1,629
  • 9
  • 30
  • 72

1 Answers1

1
  • Use match instead of =~

JSONPath

$.jobs[?(@.name.match(/release/i))].url

enter image description here

Akshay G
  • 2,070
  • 1
  • 15
  • 33