Search code examples
regexinspec

Suitable Regex for finding value to a key in yaml file


I want to make sure that I am using aescbc as provider.

kind: EncryptionConfig
apiVersion: v1
resources:
  - resources:
    - secrets
    providers:
    - aescbc:
        keys:
        - name: key1

Solution

  • I guess,

    \bproviders:\s*-\s*\baescbc:
    

    might simply suffice on s mode.


    If you wish to simplify/modify/explore the expression, it's been explained on the top right panel of regex101.com. If you'd like, you can also watch in this link, how it would match against some sample inputs.