📄 checkdoc
checkdoc is a lightweight Python utility for scanning .docx Word documents for specified regex patterns. It can be used as a command-line tool or imported as a module in larger projects.
🔍 Features
- Search for multiple regex patterns (supports full Python regex syntax)
- Scans both paragraphs and tables
- Case-insensitive matching by default
- Simple CLI interface
📦 Installation
The recommended usage is with uv:
uvx checkdoc
You can install the required dependencies using pip:
pip install python-docx
or uv:
uv add checkdoc
🚀 Usage
Command Line
uvx checkdoc path/to/document.docx pattern1 pattern2 ...
Examples:
Search for email addresses and phone numbers:
uvx checkdoc report.docx "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b" "\d{3}-\d{3}-\d{4}"
Search for any 4-digit year:
uvx checkdoc contract.docx "\b(19|20)\d{2}\b"
Search for the exact word "confidential" (not part of other words):
uvx checkdoc memo.docx "\bconfidential\b"
As a Module
from checkdoc import find_phrases_in_docx
* Use raw strings (r"") to avoid escaping issues
matches = find_phrases_in_docx("test.docx", [r"\bemail\b", r"\d{4}"])
for line in matches:
print(line)
🧠 How It Works
- Loads the
.docxfile usingpython-docx - Scans all paragraphs and table cells
- Uses Python’s
remodule to match regex patterns case-insensitively - Returns matching text snippets (full paragraph/cell content)
📝 Regex Tips
- Use raw strings (
r"pattern") in Python code to avoid backslash escaping issues. - Patterns are automatically matched case-insensitively.
- Use
\bfor word boundaries to avoid partial matches. - Use
^and$to match entire lines if needed. - Test complex patterns with tools like regex101.com first.
🛠 Requirements
- Python 3.13+
python-docx
📃 License
GNU GPLv3 License. See LICENSE file for details.
Metadata
Release files for checkdoc 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| checkdoc-0.2.0.tar.gz | 21.2 kB | Without provenance | Details for checkdoc-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| checkdoc-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for checkdoc-0.2.0-py3-none-any.whl |
Total release size: 24.9 kB
Release files / checkdoc-0.2.0.tar.gz
| Download URL | checkdoc-0.2.0.tar.gz |
|---|---|
| Size | 21.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
188d465395c58de3bde7ffbf4e1752c852b15a7bf8996d414be1589e91fc502a
|
|
BLAKE2b-256 checksum How to use checksums |
a64e0426a72327050a1bfaabf55d8b19de5e871116cfe0a70e02e1a0a9498618
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.2
|
Release files / checkdoc-0.2.0-py3-none-any.whl
| Download URL | checkdoc-0.2.0-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
173eb1f2213dce9112317838572cd887866b693ec39610786f5ac90f1a028200
|
|
BLAKE2b-256 checksum How to use checksums |
1e8f2fe13384890f1a3978c3d74fa2e0b29fc7ab6cd905c93b179f3526d9843f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.2
|
Security for checkdoc 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.