Regex REST API for easier codebase maintenance of regex
An open-source REST API called Readable Regex that lets you do common string manipulation tasks (like validating emails or extracting numbers) with simple API calls. Reduces regex maintenance in codebases and improves code readability.
While working at my company, I faced the problem of updating legacy code using Regex expressions that were difficult to understand and that I didn’t write. The code was acquired from another company and I didn’t have any experience with it or how it was written, which is always challenging.
While debugging our updates of the code, it was challenging to understand what the regex expressions were doing. In the age of AI, I could have easily popped some regex expressions into a tool like ChatGPT or Gemini to describe and alter them to fit my needs. However, this would only solve the problem in one repo at a time among a distributed set of repositories for this system. This would also be tedious and not solve the broader problem at hand.
Although Regex is a powerful language to validate and parse data, it contributes to less readable codebases, cluttered with comments to describe ciphers that make code less maintainable.
When code is less maintainable, it’s harder to understand, update, and improve on. This can slow team velocity and increase the risk of introducing bugs by incorrectly updating existing code.
I thought "What if we didn't have to maintain or write regex and we could use a REST API to transform and validate our data with easily readable methods?"
That is how readable regex was born!
I built the first version of an open-source API called Readable Regex that lets you do common string manipulation tasks (like validating emails or extracting numbers) with simple API calls, and with no complex regex required!
Gemini helped me generate a lot of the code (a lot of which I didn’t want to write yet again from scratch), and handle tricky stuff like URL encoding. It was a super cool experience that showed me how AI can make coding faster, easier, and more fun.
I want to gather feedback from fellow developers to see if this is worth working on in the future or if it would help others.
I wanted to build something fast that I could validate very quickly and solve a simple problem at scale.
Some possible future additional features could include:
Many more regex validations/transformation routes
Rate limiting to prevent server resource exhaustion
Caching for faster responses
API keys to prevent malicious usage
Swagger docs for easier API usage
Batch processing of inputs to speed up client-side performance
Library code generation for languages like Python, Java, and PHP (similar to how Google generates their SDK libraries from a REST API).
An AI component (for learning purposes) like predictive validations/transformations based on the input value and input context (email, document, number, use case). Maybe even an LLM integration on the API client side to generate new rules and open PRs without developer intervention
Scaling capabilities using a load balancer or Heroku solutions
More code organization to organize the routes and functions
More complex validations that may even go outside the realm of regex
The available endpoints so far are:
onlyNumbers
onlyLetters
onlySpecialCharacters
isEmailAddress
isPhoneNumber
The endpoints aren't perfect and may not handle all edge cases. However this was built fast to validate the concept
An example API call is on the product landing page written in JavaScript. Right now it's super simple. All are GET requests and there is one query parameter "inputString" that defines what you want to validate or transform.
Here's an example call you can make within your client application.
https://readable-regex-8d81b7916...
I wrote a medium article on my process of discovery and development here https://medium.com/p/d0bce667dab9
Here is the client app to test the API calls and read some of the bare bones documentation I wrote
https://readable-regex-8d81b7916...
I am eager to hear your feedback, thank you!