https://github.com/datumbrain/py-redact
Document redaction.
https://github.com/datumbrain/py-redact
Last synced: about 2 months ago
JSON representation
Document redaction.
- Host: GitHub
- URL: https://github.com/datumbrain/py-redact
- Owner: datumbrain
- License: mit
- Created: 2020-07-07T13:47:35.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-24T16:36:25.000Z (almost 6 years ago)
- Last Synced: 2025-09-24T22:37:34.808Z (9 months ago)
- Language: Python
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py_redact
Document redaction library in Python.
## Install Requirements
```
pip install py_redact
```
## Example Usage
### Redact Microsoft Word Document
```python
from py_redact.docx_redactor import DocxRedactor
replace_char = '*'
regexes = [r"""\d{3}-\d{2}-\d{4}""", r"""(([a-zA-Z0-9_\.+-]+)@([a-zA-Z0-9-]+)\.[a-zA-Z0-9-\.]+)"""]
redactor = DocxRedactor(input_file, regexes, replace_char)
redactor.redact(output_file_path)
```
### Redact Microsoft Power Point Presentation
```python
from py_redact.pptx_redactor import PptxRedactor
replace_char = '*'
regexes = [r"""\d{3}-\d{2}-\d{4}""", r"""(([a-zA-Z0-9_\.+-]+)@([a-zA-Z0-9-]+)\.[a-zA-Z0-9-\.]+)"""]
redactor = PptxRedactor(input_file, regexes, replace_char)
redactor.redact(output_file_path)
```
### Redact Microsoft Excel Sheet
```python
from py_redact.xlsx_redactor import XlsxRedactor
replace_char = '*'
regexes = [r"""\d{3}-\d{2}-\d{4}""", r"""(([a-zA-Z0-9_\.+-]+)@([a-zA-Z0-9-]+)\.[a-zA-Z0-9-\.]+)"""]
redactor = XlsxRedactor(input_file, regexes, replace_char)
redactor.redact(output_file_path)
```