title: Regex for git commit-msg hook
body: <p>I am trying to achieve following structure for git commit msg:</p>
  
  <pre><code>X=Uppercase character
  Y=Number 0-9
  category=fix, chore, doc, etc...
  
  XXXXY-YYY [category] XXXXX*
  </code></pre>
  
  <p>this is my commit-msg file</p>
  
  <pre><code>MSG_FILE=$1
  FILE_CONTENT="$(cat $MSG_FILE)"
  # Initialize constants here
  export REGEX="\D\D\D\D\d-\d\d\d \[(fix|poc|chore|feat|refactor|style|test)\] .*"
  export ERROR_MSG="Commit message format must match regex \"${REGEX}\""
  if [[ $FILE_CONTENT =~ $REGEX ]]; then
   echo "Nice commit!"
  else
    echo "Bad commit \"$FILE_CONTENT\", check format."
   echo $ERROR_MSG
   exit 1
  fi
  exit 0
  </code></pre>
  
  <p>But all I get is:</p>
  
  <pre><code>    $ git commit -m "PBCL2-666 [fix] whatever"
  Bad commit "PBCL2-666 [fix] whatever", check format.
  Commit message format must match regex "\D\D\D\D\d-\d\d\d \[(fix|poc|chore|feat|refactor|style|test)\] .*"
  </code></pre>
  
  <p>Any ideas?</p>