Thomas
Thomas

Reputation: 43

How to match string with prefix using JMESPATH? It seems to only want to match exact string

Given

[
  {
    "assigned-entity-id": null,
    "assigned-entity-type": null,
    "availability-domain": null,
    "compartment-id": "ocid1.compartment",
    "defined-tags": {
      "namesp": {
        "CreatedBy": "oracleidentitycloudservice",
        "CreatedOn": "2024-05-10T20:48:15.859Z"
      }
    },
    "display-name": "foobar",
    "freeform-tags": {},
    "id": "ocid1.publicip",
    "ip-address": "8.8.8.8",
    "lifecycle-state": "AVAILABLE",
    "lifetime": "RESERVED",
    "private-ip-id": null,
    "public-ip-pool-id": null,
    "scope": "REGION",
    "time-created": "2024-05-10T20:48:16.062000+00:00"
  }
]

JMESPATH input works when using

data[?"display-name" == 'foobar']

But I would like to use foo to match as a prefix like 'foo*'

I tried

data[?"display-name" == 'foo*']

which doesn't return any result.

Upvotes: 0

Views: 58

Answers (0)

Related Questions