Does anyone know of a library (preferably php) or algorithm for auto-generating regex's from some common descriptions?
For example, have a form with the possible options of:
- Length (=x, between x & y, etc)
- Starts with
- Ends with
- Character(s) x(yz) at index i
- Specify one or more alternative behavior based on the above
- And so on..
The idea is that for certain data entities in a system, you'll be able to go to a form and set this criteria for a data field. Afterward, any time that data field for that type of data entity is entered, it will be validated against the regex.
This seems like it could grow into a complex problem though, so I'm not expecting anyone to solve it as a whole. Any suggestions are much appreciated.