Re: [Early Feedback] Pattern matching
| From: | Rowan Tommins [IMSoP] | Date: | Sat, 22 Jun 2024 17:10:58 +0000 |
| Subject: | Re: [Early Feedback] Pattern matching | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-123751@lists.php.net to get a copy of this message | ||
On 21/06/2024 19:03, Larry Garfield wrote:
I think what Marc means is that it's weird to see the regex syntax outside of a quoted string, since we don't currently have that syntax defined in PHP. It's not even clear what the constraints of that syntax would be; for instance, this is valid PHP: $result = preg_match(subject: $string, pattern: "# (int|string) /*(.*/) #xi"); But I'm guessing it would be a challenge to parse this: $result = $string is # (int|string) /*(.*/) #xi; The simple answer is probably to use a more limited syntax, but defining that syntax probably deserves its own discussion. -- Rowan Tommins [IMSoP]* Regex pattern This one is interesting as well ... but I would expect native regex syntax first before introducing it as part of a different RFC. Similar as generics.Named capture groups are already part of regex syntax, just not often used. The example is not introducing anything new there. (Although Ilija tells me it may be hard to implement, so it may get postponed anyway. TBD.)