> On Wed, Sep 23, 2026, at 21:01, Gina P. Banyard wrote:
>
> This class could lay the foundation on which to build a new nice OO API
I also like the idea. Not exactly because I have something against the
original proposal of PREG_THROW_..., but because your suggestion can
(possibly?) increase performance for those apps who use regexps a lot.
On Fri, Sep 25, 2026 at 9:57 AM Sjoerd Langkemper wrote:
> The proposed API would result in calls like this:
> new CompiledRegex(".*", false, false, false, true, true, true, false, true)
> where it is hard to determine what all the true/false parameters mean. Would
> it be better to pass enums instead? Or is this solved by editor hints
> nowadays?
That is also my concern. Since people have been using regexps in PHP
for ages in a way they are, I believe it should be possible to make an
instance of CompiledRegex from a usual pattern-string. In my practice,
I don't use many different modifiers, but those which I do use often
(mostly "i" and "s") - I type them automatically when writing a
pattern. Like a muscle-memory. In other words, it is easier for me to
still input them as part of the pattern that supplying them as
parameters. Besides, such a possibility will simplify the process of
migration to this class and possible future API: you just copy an
existing pattern without bothering to extract the modifiers from it.
Regards,
Alexandr Egorov.