SHA-1 Hash Regular Expression

A regular expression to match SHA-1 hashes.

/\b([a-f0-9]{40})\b/

If you’re looking for a regex that matchesa SHA-1 word within a string:

/\b([a-f0-9]{40})\b/

SHA-1 Hash Examples:

  • 6f2ab963b5a51d155d69ac091e52e506d1055057
  • 194E13DA720A1F025685E5D677EBA8A1AFF3860A

See Also:

Regex Is Copied!