I want to write a regular expression that detects passwords in texts and binary data, so that I can flag files that contain potential secrets.
The rule for a password should be something like:
The string should contain:
at least 10 characters
at least one lower case letter
at least one higher case letter
at least one numeric character
at least one punctuation character
I've tried writing it in PCRE flavour of regex (tested with PHP in https://regex101.com) with lookbehinds and lookaheads, but have failed in general. Is there any way out there to achieve the goal?
My current regex is:
(?
that seems to work for strings, but not on binary data where the password is not surrounded by whitespace characters