![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 16 Pomógł: 0 Dołączył: 11.11.2008 Ostrzeżenie: (0%) ![]() ![]() |
Cześć. Mam proste wyrażenie regularne sprawdzające poprawność maila:
/^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$/ Chciałbym się dowiedzieć czy można do niego dodać warunek, który sprawdzi długość całego maila np. żeby max mógł wynosić 255 znaków? Jeżeli tak to jak to zrobić? Wiem, że mogę sobie osobno wywołać funkcję strlen(), ale chciałbym to zawrzeć w wyrażeniu regularnym i w ogóle ciekawi mnie to czy można. |
|
|
![]() |
![]()
Post
#2
|
|
Newsman Grupa: Moderatorzy Postów: 2 033 Pomógł: 290 Dołączył: 21.12.2007 Skąd: Łódź ![]() |
Cytat Btw: adres mail w teorii może mieć więcej niż 255 znaków. Uściślając: 64 znaki nazwy uzytkownika (przed małpką) oraz 255 znaków tworzących domenę (po małpce) + małpka = 320 znaków. Żródło: RFC2821 (SMTP, z 2001 roku, które zastąpiło starsze RFC821, gdzie adres mógł mieć odpowiednio 64+64 znaki) Cytat (...)
There are several objects that have required minimum/maximum sizes. Every implementation MUST be able to receive objects of at least these sizes. Objects larger than these sizes SHOULD be avoided when possible. However, some Internet mail constructs such as encoded X.400 addresses [16] will often require larger objects: clients MAY attempt to transmit these, but MUST be prepared for a server to reject them if they cannot be handled by it. To the maximum extent possible, implementation techniques which impose no limits on the length of these objects should be used. local-part The maximum total length of a user name or other local-part is 64 characters. domain The maximum total length of a domain name or number is 255 characters. (...) |
|
|
![]() ![]() |
![]() |
Aktualny czas: 10.10.2025 - 04:03 |