Adding filterByRegex method to Laravel Collections #55147
Unanswered
mohammadrasoulasghari
asked this question in
Ideas
Replies: 1 comment 1 reply
-
While it is possible using filter, that one uses a closure. I would opt for altering filter to accept a string that executes the regular expression. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone! I'm considering contributing a new method to Laravel's Collection class called
filterByRegex
.What it does
The method would allow filtering collections using regular expressions in a clean, readable way:
Why I think it’s useful
While this can be done with the existing filter() method, filterByRegex would:
Questions
I’d appreciate your thoughts before submitting a PR. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions