Substring of Parameter or Partial String Match in WHEN Block

prod-workflow:
    when:
      or:
        # This... is unacceptable. Can't figure out how to substring the parameter, 
        # or use an alternative to 'equal' that allows for partial or regex matching.
        - equal: [prod-aa, << pipeline.parameters.target-env >>]
        - equal: [prod-bb, << pipeline.parameters.target-env >>]
        - equal: [prod-cc, << pipeline.parameters.target-env >>]
        - equal: [prod-dd, << pipeline.parameters.target-env >>]

I would prefer to match on prod-*, to allow for the possibility of adding additional environments in future (e.g.: prod-ee, prod-ff, etc.). Suggestions?

Hi @littlefixit,

Thank you for sharing your question on our forum.

This can be done with the matches key and by specifying a regex as explained here:

https://circleci.com/docs/configuration-reference#logic-statement-examples

Here is a rough example:

workflows:
  prod-workflow:
    when:
      matches:
        pattern: "^prod-.+$"
        value: << pipeline.parameters.target-env >>

Could you try this out on your end, and let me know if it works?