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... 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. 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 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. Link to comment https://forums.phpfreaks.com/topic/206349-max-length/#findComment-1079583 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.