Home > Software design >  Regex not working in bash (MacOS) when trying to validate commit message with husky
Regex not working in bash (MacOS) when trying to validate commit message with husky

Time:10-29

I tried to write the next regex for checking GIT commit message with husky

My script:

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

message="$(cat $1)"
if ! [[ $message =~ ^\[.*?\] (resolved|fixed) \#([0-9])* ([A-Z])\w.*$ ]];
then
  echo "           
  • Related