title: regular expression for [STRING] in gitlab-ci.yml file
body: <p>I am tyring to set rule for deployment stage in gitlab-ci.yml file where if the git commit message is having a particular [STRING] in this format then it should deploy to that particular environment where this rule is written.</p>
  <pre><code># Deploy to QAT environment
  deploy-qat:
    stage: deploy
    extends: .helm_deploy
    environment:
      name: qat
    tags:
      - exe-prd
    rules:
      - if: $CI_COMMIT_MESSAGE =~ &quot;/[QAT]$/|/[qat]$/&quot;  #&amp;&amp;  $CI_COMMIT_REF_NAME == &quot;example/qat&quot;
        when: always
  </code></pre>
  <p>I have wrote above rule however it is not working. I have tried below combinations of regular expressions however none of them are working.</p>
  <pre><code>&quot;/\[QAT\]/|/\[qat\]/&quot;
  &quot;/[QAT]/|/[qat]/&quot;
  &quot;*\[QAT\]*|*\[qat\]*&quot;
  &quot;\[\(QAT\|qat\)\]&quot;
  &quot;\[\(QAT\|qat\)]&quot;
  &quot;/\[(qat|QAT)\]/&quot;
  </code></pre>
  <p>I tried following website for regular expression <a href="https://regex101.com/r/cO8lqs/6" rel="noreferrer">here</a> which validates my requirement but it is not working inside gitlab-ci.yml file.</p>