Instead of using mb_strlen
and preg_match
, I'm trying to devise a purely regex solution, so that I can shorten my code by piping everything through a function.
Minimum Possible Input (number chars are only used to demonstrate quantity)
1@1234
Maximum Possible Input (number chars are only used to demonstrate quantity)
123456789012345678901234567890123456789012345@1234
1@123456789012345678901234567890123456789012345678
- and everything in between like
123456790@123456789012345678901234567890123456789
The current pattern I've devised is ^.{1,}?@.{4,}?$
, but I'm not sure how to limit the total characters to 50?
I've tried capturing and grouping everything (e.g. (^.{1,}?@.{4,}?$){,50}
, [^.{1,}?@.{4,}?$]{,50}
), but these obviously don't work.