|
@@ 1015-1033 (lines=19) @@
|
| 1012 |
|
} |
| 1013 |
|
} |
| 1014 |
|
switch ($patternselect) { |
| 1015 |
|
case 'pcre8': |
| 1016 |
|
/** |
| 1017 |
|
* Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains. |
| 1018 |
|
* @link http://squiloople.com/2009/12/20/email-address-validation/ |
| 1019 |
|
* @copyright 2009-2010 Michael Rushton |
| 1020 |
|
* Feel free to use and redistribute this code. But please keep this copyright notice. |
| 1021 |
|
*/ |
| 1022 |
|
return (boolean)preg_match( |
| 1023 |
|
'/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' . |
| 1024 |
|
'((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . |
| 1025 |
|
'(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . |
| 1026 |
|
'([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . |
| 1027 |
|
'(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . |
| 1028 |
|
'(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . |
| 1029 |
|
'|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . |
| 1030 |
|
'|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . |
| 1031 |
|
'|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', |
| 1032 |
|
$address |
| 1033 |
|
); |
| 1034 |
|
case 'pcre': |
| 1035 |
|
//An older regex that doesn't need a recent PCRE |
| 1036 |
|
return (boolean)preg_match( |
|
@@ 1034-1048 (lines=15) @@
|
| 1031 |
|
'|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', |
| 1032 |
|
$address |
| 1033 |
|
); |
| 1034 |
|
case 'pcre': |
| 1035 |
|
//An older regex that doesn't need a recent PCRE |
| 1036 |
|
return (boolean)preg_match( |
| 1037 |
|
'/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' . |
| 1038 |
|
'[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' . |
| 1039 |
|
'(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' . |
| 1040 |
|
'@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' . |
| 1041 |
|
'(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' . |
| 1042 |
|
'[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' . |
| 1043 |
|
'::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' . |
| 1044 |
|
'[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' . |
| 1045 |
|
'::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' . |
| 1046 |
|
'|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD', |
| 1047 |
|
$address |
| 1048 |
|
); |
| 1049 |
|
case 'html5': |
| 1050 |
|
/** |
| 1051 |
|
* This is the pattern used in the HTML5 spec for validation of 'email' type form input elements. |