In T-Regx 0.9.10, we decided to remove
Pattern::prepare() from T-Regx.
Originally, the idea behind this function was quite simple. We wanted to enable quick and readable parameter binding:
Fairly easy, at the first glance.
Its messyness becomes visible, when regular expressions become few and short, and texts are multiple and long, sometimes with alteration:
You can see, the outer layer array combined with the
[$domain] array and array for schema
becomes quite hard to read. Additionally, because of alteration, it becomes even more unreadable!
It was very easy to misread the parameter array with alteration array, or even regular regex with text.
So at first, we decided to remove it from the library, but then, because of one of the users comment in GitHub issues, we decided that perhaps it would be better not to remove the method, but fix it.
In this case, fixing it would be disallowing such confusing constructs as alteration in prepared patterns.
So we decided to bring back
Pattern::prepare(), but remove alteration so the messy queries won't appear
in the source code.
Alteration is still available for