note 90274 added to function.preg-match-all

From: Date: Tue, 14 Apr 2009 11:23:44 +0000
Subject: note 90274 added to function.preg-match-all
Groups: php.notes 
Request: Send a blank email to php-notes+get-153198@lists.php.net to get a copy of this message
<?php function mime_extract_rfc2822_address($string) { //rfc2822 token setup $crlf = "(?:\r\n)"; $wsp = "[\t ]"; $text = "[\\x01-\\x09\\x0B\\x0C\\x0E-\\x7F]"; $quoted_pair = "(?:\\\\$text)"; $fws = "(?:(?:$wsp*$crlf)?$wsp+)"; $ctext = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F" . "!-'*-[\\]-\\x7F]"; $comment = "(\\((?:$fws?(?:$ctext|$quoted_pair|(?1)))*" . "$fws?\\))"; $cfws = "(?:(?:$fws?$comment)*(?:(?:$fws?$comment)|$fws))"; //$cfws = $fws; //an alternative to comments $atext = "[!#-'*+\\-\\/0-9=?A-Z\\^-~]"; $atom = "(?:$cfws?$atext+$cfws?)"; $dot_atom_text = "(?:$atext+(?:\\.$atext+)*)"; $dot_atom = "(?:$cfws?$dot_atom_text$cfws?)"; $qtext = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F!#-[\\]-\\x7F]"; $qcontent = "(?:$qtext|$quoted_pair)"; $quoted_string = "(?:$cfws?\"(?:$fws?$qcontent)*$fws?\"$cfws?)"; $dtext = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F!-Z\\^-\\x7F]"; $dcontent = "(?:$dtext|$quoted_pair)"; $domain_literal = "(?:$cfws?\\[(?:$fws?$dcontent)*$fws?]$cfws?)"; $domain = "(?:$dot_atom|$domain_literal)"; $local_part = "(?:$dot_atom|$quoted_string)"; $addr_spec = "($local_part@$domain)"; $display_name = "(?:(?:$atom|$quoted_string)+)"; $angle_addr = "(?:$cfws?<$addr_spec>$cfws?)"; $name_addr = "(?:$display_name?$angle_addr)"; $mailbox = "(?:$name_addr|$addr_spec)"; $mailbox_list = "(?:(?:(?:(?<=:)|,)$mailbox)+)"; $group = "(?:$display_name:(?:$mailbox_list|$cfws)?;$cfws?)"; $address = "(?:$mailbox|$group)"; $address_list = "(?:(?:^|,)$address)+"; //output length of string (just so you see how f**king long it is) echo(strlen($address_list) . " "); //apply expression preg_match_all("/^$address_list$/", $string, $array, PREG_SET_ORDER); return $array; }; ?> ---- Server IP: 78.41.104.4 Probable Submitter: 85.172.11.132 ---- Manual Page -- http://www.php.net/manual/en/function.preg-match-all.php Edit -- https://master.php.net/note/edit/90274 Del: integrated -- https://master.php.net/note/delete/90274/integrated Del: useless -- https://master.php.net/note/delete/90274/useless Del: bad code -- https://master.php.net/note/delete/90274/bad+code Del: spam -- https://master.php.net/note/delete/90274/spam Del: non-english -- https://master.php.net/note/delete/90274/non-english Del: in docs -- https://master.php.net/note/delete/90274/in+docs Del: other reasons-- https://master.php.net/note/delete/90274 Reject -- https://master.php.net/note/reject/90274 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#153198) next »