Text Formatter
A convenient bundle of text formatting tools.
Github Repository
The “Text Formatter” tool is a modular text-processing utility that provides multiple modes for transforming and formatting text-based string data. The project began as a small script for prepending text to a list of strings (used to format data prior to uploading it to a SaaS platform). Over time, I built additional utilities, including a template-filling tool for structured text generation. As these tools became more related in purpose, I merged them into a single unified program. As my needs evolved, I expanded the project with additional functionality, including modes for regex-based single replacement and multiple replacement string transformations. To support the growing feature set, I refactored the codebase into a modular architecture, consisting of a base program file and separate files for each mode. This refined structure greatly improved maintainability and made it significantly easier to extend functionality with minimal integration overhead.
Architecture Highlights
- Refactored initial monolithic script into a modular architecture separating core logic and individual formatting modes
- Designed each formatting mode as an isolated module to improve maintainability and reduce coupling
- Structured system to allow new transformation modes to be added with minimal changes to existing logic
Key Features
- Format List — Adds a custom prefix or suffix to each item in a list
- Fill Template — Fills out custom text-based templates with user-defined values
- Regex Single Replacement — Uses a regex pattern to replace matches in a single string
- Regex Multiple Replacement — Applies multiple sequential regex replacements to a single string
Tech Stack
Utilities
- Python
- Regex (re module)
Technical Challenges & Lessons Learned
- Monolith Architecture Scaling Issues
- As I introduced new modes, my codebase slowly evolved into a large, difficult to maintain, monolith. This made it increasingly difficult to maintain and extend the program. To address this, I refactored the system into a modular architecture, consisting of shared base program file and separate modules for each formatting mode. This restructuring significantly improved maintainability and allowed new functionality to be added without modifying existing core logic.