RegEx to find value in JSON

Tags: ,

I need to write a RegEx on a JSON to match everything that starts with {$ and ends with }

I tried with /{(.*?)}/g and it seemingly works fine but if you see the image below it also matches the other text so how do I explicitly write a RegEx for my requirement

The reason for the ask is I need to find values with {$*} and replace them with a string

enter image description here

Below is my JSON

    "name": "{$StubName}",
    "request": {
        "method": "POST",
        "url": "/marks/{$Name}",
        "bodyPatterns": [
                "equalToJson": "{n    "name": "{$RequestName}",n    "job": "{$Role}"n}"
    "response": {
        "status": "201",
        "headers": {
            "Content-Type": "application/json"
        "body": "{n    "name": "{$RequestName}",n    "job": "{$Role}",n    "id": "{$id}",n    "createdAt": "{$Time}"n}"


You can use {$w*}

Regex demo

Source: stackoverflow