fork download
  1. #!/bin/bash
  2. regex='ref: ?[DU][ES][0-9]+';
  3. string="My commit ref: US2233556"
  4.  
  5. if [[ $string =~ $regex ]];
  6. then
  7. echo "[SUCCESS] Your message contains ref: for a Story or Defect."
  8. else
  9. echo "[POLICY] Your message is not formatted correctly. Please include a \"ref: USXXXXX\" or \"ref: DEXXX\" in the commit message."
  10. fi
Success #stdin #stdout 0s 5100KB
stdin
Standard input is empty
stdout
[SUCCESS] Your message contains ref: for a Story or Defect.