Closed amoutonbrady closed 4 years ago
Thanks for the pull request. I think that altering the regex will be a better option, not necessarily because of performance(although I do think that it might be faster) but because it makes it simpler because whoever reads the code if he understands regex will expect it to be entirely handled by the regexp match.
I'll update the regexp(unless you want to take this on).
Thanks for getting back to me this quick! Please go ahead and do it, regexp can be hard to get right, I trust you more than I trust myself haha 😅
No problem. I'll have this fixed today hopefully. As a side note, I highly recommend you to take these lessons if you are interested in regexp: https://laracasts.com/series/understanding-regular-expressions
EDIT: Not sponsored or anything, but it's the same lessons I took when I learned this, and he's a great teacher!
I will give it a shot, thanks for the recommendation and thank you for your reactivity, I'm glad I chose this option for my current project!
Some (maybe all) error messages comes with a white space before the explication of the message. The regex strips everything after
:
but not the space before it. One example of this is the "Too many attemps" error that yields the following:Applying your regexp it returns: "TOO_MANY_ATTEMPTS_TRY_LATER ".
I'm not sure what's more efficient between altering the regexp to handle that case or using
.trim()
on the final message.