is mainly to check the content of git commit, so as to prevent entering console.log
simply verifying console.log will misjudge the deletion of console.log and comment out console.log
so you need to check
existing regexp=" ^\ +. * console\ .log ("
you can verify the addition, but not whether it is a comment
Test string
+ / console.log ("aaa") should return false
+ console.log (111) should return true