{"id":10311,"library":"trufflehogregexes","title":"TruffleHog Regexes","description":"trufflehogregexes is a Python package that provides the core regular expressions used by the TruffleHog secrets scanner. It offers a structured list of dictionaries, each containing a regex pattern, ID, name, and tags for various sensitive information. Currently at version 0.0.7, it has a low release cadence, primarily serving as a data dependency for the main TruffleHog application.","status":"active","version":"0.0.7","language":"en","source_language":"en","source_url":"https://github.com/dxa4481/truffleHogRegexes","tags":["security","regex","trufflehog","secrets","data-package"],"install":[{"cmd":"pip install trufflehogregexes","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The primary list of regexes is directly exposed as a module-level variable, not a function.","wrong":"from trufflehogregexes import get_regexes","symbol":"regexes","correct":"from trufflehogregexes import regexes"}],"quickstart":{"code":"from trufflehogregexes import regexes\n\n# The 'regexes' variable is a list of dictionaries\nprint(f\"Total regexes available: {len(regexes)}\")\nif regexes:\n    first_regex = regexes[0]\n    print(f\"\\nExample regex entry:\")\n    print(f\"  ID: {first_regex.get('id')}\")\n    print(f\"  Name: {first_regex.get('name')}\")\n    print(f\"  Regex: {first_regex.get('regex')}\")\n    print(f\"  Tags: {first_regex.get('tags')}\")\n\n    # To actually use a regex, you'd compile and run it:\n    import re\n    test_string = \"My private key is: AKIAIOSFODNN7EXAMPLE\"\n    for r_entry in regexes:\n        pattern = r_entry.get('regex')\n        if pattern:\n            # Note: some regexes might require 're.DOTALL' or other flags\n            match = re.search(pattern, test_string)\n            if match:\n                print(f\"\\nMatch found for '{r_entry.get('name')}': {match.group(0)}\")\n                break # Found one match for demonstration","lang":"python","description":"This example demonstrates how to import and inspect the `regexes` list. It also shows a basic way to iterate and apply one of the regexes using Python's `re` module, as the package only provides the patterns, not the matching logic."},"warnings":[{"fix":"Access the `regexes` list directly after importing: `from trufflehogregexes import regexes` then `regexes[0]` or `len(regexes)`.","message":"The `regexes` list is a module-level variable, not a function. Do not attempt to call it or use a `get_regexes()` style accessor.","severity":"gotcha","affected_versions":"0.0.1 - current"},{"fix":"Use `import re` and then `re.search(entry['regex'], text)` to perform matching with the provided patterns.","message":"This package provides only the regular expression patterns as data; it does not include any regex matching or scanning functionality. Users must integrate their own regex engine (e.g., Python's `re` module) to apply these patterns.","severity":"gotcha","affected_versions":"0.0.1 - current"},{"fix":"When consuming regex entries, use `.get()` for dictionary access (e.g., `entry.get('regex')`) to gracefully handle potentially missing keys after an upgrade. Monitor the GitHub repository for updates if relying on specific entry fields.","message":"As a pre-1.0.0 package (current version 0.0.7), the structure of regex entries (e.g., dictionary keys like 'id', 'name', 'regex', 'tags') might change in minor versions without strict backward compatibility guarantees.","severity":"gotcha","affected_versions":"0.0.1 - current"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"The regex list is directly exposed as a module-level variable. Use `from trufflehogregexes import regexes` and then access `regexes` directly.","cause":"Attempting to call a non-existent function to retrieve the regexes list, assuming a common getter pattern.","error":"AttributeError: module 'trufflehogregexes' has no attribute 'get_regexes'"},{"fix":"`regexes` is a list, not a function. Access its elements using indexing (`regexes[0]`) or iterate over it directly.","cause":"Trying to call the `regexes` variable as if it were a function, e.g., `regexes()`.","error":"TypeError: 'list' object is not callable"},{"fix":"Ensure you explicitly import `regexes` using `from trufflehogregexes import regexes`, or access it via the module namespace as `trufflehogregexes.regexes` after `import trufflehogregexes`.","cause":"Attempting to use `regexes` without importing it explicitly, especially after `import trufflehogregexes` without specifying `trufflehogregexes.regexes`.","error":"NameError: name 'regexes' is not defined"}]}