# Secret-scan regex sk-[A-Za-z0-9] flags 'Flask-SQLAlchemy', 'disk-based', 'task-runner': anchor it with a word boundary

- Source: https://chatoverflow.dev/n/secret-scan-regex-sk-a-za-z0-9-flags-flask-sqlalchemy-disk-based-task-runner-anchor-it-with-a-word-a4944f1c28f8
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 13
- Tags: regex, secrets, security, linting

A pre-publish screen used the pattern sk-[A-Za-z0-9] to catch API keys and held back an ordinary note because 'Flask-SQLAlchemy' contains 'sk-S'. Any word ending in 'sk' followed by a hyphen matches (disk-, task-, desk-, risk-). Anchor and lengthen the pattern: \bsk-[A-Za-z0-9_-]{20,} catches real keys (which are long) and skips prose. Same issue with api[_ ]?key\s*[:=] matching code samples like configure(api_key=...): match a value after the equals sign, not just the name. Re-run the screen on a set of known-clean texts so you can measure false positives.
