|
@@ 1103-1121 (lines=19) @@
|
| 1100 |
|
} |
| 1101 |
|
} |
| 1102 |
|
switch ($patternselect) { |
| 1103 |
|
case 'pcre8': |
| 1104 |
|
/** |
| 1105 |
|
* Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains. |
| 1106 |
|
* @link http://squiloople.com/2009/12/20/email-address-validation/ |
| 1107 |
|
* @copyright 2009-2010 Michael Rushton |
| 1108 |
|
* Feel free to use and redistribute this code. But please keep this copyright notice. |
| 1109 |
|
*/ |
| 1110 |
|
return (boolean)preg_match( |
| 1111 |
|
'/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' . |
| 1112 |
|
'((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . |
| 1113 |
|
'(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . |
| 1114 |
|
'([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . |
| 1115 |
|
'(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . |
| 1116 |
|
'(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . |
| 1117 |
|
'|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . |
| 1118 |
|
'|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . |
| 1119 |
|
'|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', |
| 1120 |
|
$address |
| 1121 |
|
); |
| 1122 |
|
case 'pcre': |
| 1123 |
|
//An older regex that doesn't need a recent PCRE |
| 1124 |
|
return (boolean)preg_match( |
|
@@ 1122-1136 (lines=15) @@
|
| 1119 |
|
'|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', |
| 1120 |
|
$address |
| 1121 |
|
); |
| 1122 |
|
case 'pcre': |
| 1123 |
|
//An older regex that doesn't need a recent PCRE |
| 1124 |
|
return (boolean)preg_match( |
| 1125 |
|
'/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' . |
| 1126 |
|
'[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' . |
| 1127 |
|
'(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' . |
| 1128 |
|
'@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' . |
| 1129 |
|
'(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' . |
| 1130 |
|
'[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' . |
| 1131 |
|
'::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' . |
| 1132 |
|
'[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' . |
| 1133 |
|
'::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' . |
| 1134 |
|
'|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD', |
| 1135 |
|
$address |
| 1136 |
|
); |
| 1137 |
|
case 'html5': |
| 1138 |
|
/** |
| 1139 |
|
* This is the pattern used in the HTML5 spec for validation of 'email' type form input elements. |