shane18 Posted July 1, 2010 Share Posted July 1, 2010 /^[A-Z0-9._-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i How can I make this e-mail validation code limit the whole string to 6 to 80 characters... Quote Link to comment https://forums.phpfreaks.com/topic/206349-max-length/ Share on other sites More sharing options...
premiso Posted July 1, 2010 Share Posted July 1, 2010 Do validation first with strlen. If it is not within those confines then do not waste the time checking it with regex. Quote Link to comment https://forums.phpfreaks.com/topic/206349-max-length/#findComment-1079504 Share on other sites More sharing options...
shane18 Posted July 1, 2010 Author Share Posted July 1, 2010 Thank you, i knew about that but I wasn't sure if i could just add it to the regex it's self. ill do that though ty Quote Link to comment https://forums.phpfreaks.com/topic/206349-max-length/#findComment-1079529 Share on other sites More sharing options...
salathe Posted July 1, 2010 Share Posted July 1, 2010 You could add it in to the regex, but premiso's suggestion would be preferred unless you really need it to be part of the regex. Quote Link to comment https://forums.phpfreaks.com/topic/206349-max-length/#findComment-1079583 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.