How to use regexp with jq
How to use regexp with jq
How to use regexp within jq when selecting documents
1
2
3
4
5
6
PROJECT_NAMES="one|two|there"
REGEXP_SOL_PROJ="^prefix-${ENVIRONMENT}-(${PROJECT_NAMES}).*"
REGION="europe-west3"
HSM_PROJ=$(gcloud projects --format=json list | jq -r --arg RGEXP "^eaut-${ENVIRONMENT}-hsm-dap-kernel.*$" '.[] | select(.projectId|test($RGEXP)) | .projectId')
This post is licensed under CC BY 4.0 by the author.
