awslabs / git-secrets

Prevents you from committing secrets and credentials into git repositories
Apache License 2.0
12.47k stars 1.18k forks source link

Invalid preceding regular expression regex pattern #190

Open Broick opened 3 years ago

Broick commented 3 years ago

Tried adding several regex patterns like (?=.[a-z])(?=.[A-Z])(?=.[0-9])(?=.[!@\$%\^&\*])(?=.{8,}) *(?=.\d)(?=.[a-z])(?=.[A-Z])(?=.[@$%&]).{8,} etc but getting fatal error Found that issue is caused when used ? after (** Can someone help?

nasamuffin commented 3 years ago

I don't maintain this project, but I have worked with it quite a lot.

Both git_grep() and regular_grep() functions in git-secrets script pass the -E flag to use "extended regular expressions". It looks like ERE doesn't support lookaround (what you're referring to as "preceding regular expressions". Have a look at this table (you can pick regex flavors by dropdown) to see for yourself. https://www.regular-expressions.info/refadv.html