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!
@masump great question and thanks for your feedback!
I think another quick win that would boost the performance of the solution is allowing multiple input strings to validate/transform.
This way the client-side code wouldn't have to handle multiple async operations p potentially making the code less readable and less performant.
With this, one HTTP call could validate an entire form, transform values if needed, and return all the information necessary to move to the next step!
Cool project but relaying on an external HTTP service for regex validation is probably not the best way to solve problems at scale there are way too many libraries in all sorts of languages that solves the problem that this project is trying to solve one good example is https://www.npmjs.com/package/va...
@khizeryounas thanks for your feedback.
One benefit of the HTTP API approach are that you can use it regardless of platform so you don't have to rely on different libraries for each project as well. This improves code maintainability across all codebases and points to one source of functionality for Regex type operations.
Also adding batching validation/transformation of data that's platform agnostic would likely out perform those libraries and be more scalable across platforms
How about just learn it or rely on LLMs to handle the cases for you?
There are tons of free projects who can ease the learning curve, one of them being: https://regexlearn.com/ (not mine, I'm not associated to it).
@davide_vago thank you for your feedback.
Regex is a very minor yet complicated part of an engineer's work they have to complete. It's not something you work with everyday so even if you master it, it's using a lot of time that could be spent on system design, performance improvements, and other feature development.
It's not that we can't learn it, it's that we shouldn't have to because we can abstract that for developers. It's just another add on for developers to keep track of and learn in a time where technology is shifting away from writing code like this anyway given the accessibility of AI.
LLM's can certainly attempt to generate regex or write readable functions but those expressions are specific to a given library in a given repo and not cross compatible (python vs js vs java). This REST API solves that problem by being platform agnostic. If a project can make web requests, it can use it. LLM's and AI are also predictive, and not perfect which I was able to demonstrate in my build process here https://medium.com/gitconnected/...
Whether or not AI is writing the code or not, having every repo call readable endpoints from the same central API agnostic of platform makes code maintainability and refactoring a breeze.
The goal is to get rid of another developer headache and centralize it to solve the headaches of refactoring, maintainability, and readability.
Readble Regex
Readble Regex
Readble Regex
Readble Regex
JSPad
Readble Regex
Readble Regex