php - Help wanted with regular expression -
I would like to parse the string with a mailer, in which the following examples may be different from the comma (,):
< Pre> first name & lt; Email@example.com> "First name" & lt; Email@example.com> & Lt; Email@example.com> Email@example.com
I want to create an array with each entry for each element containing each sub-entry: [name] and [email].
I was struggling with regexp (what is feeling) what age can someone help me?
If you have image extensions enabled, then it can be as simple as: / P> < Pre> var_dump (imap_rfc822_parse_adrlist ('first name & lt; email@example.com> ;, "first name" & lt; email@example.com> ;, & lt; email@example.com> ;, @ email example Com ',' _ invalid_ '));
Output:
array (4) {[0] = & gt; Object (stdClass) # 1 (3) {["Mailbox"] = & gt; String (5) "email" ["host"] = & gt; String (11) "example.com" ["personal"] = & gt; String (10) "First name"} [1] = & gt; Object (stud class) # 2 (3) {["mailbox"] = & gt; String (5) "email" ["host"] = & gt; String (11) "example.com" ["personal"] = & gt; String (10) "First name"} [2] = & gt; Object (Stud Class) # 3 (2) {["Mailbox"] = & gt; String (5) "email" ["host"] = & gt; String (11) "example.com"} [3] = & gt; Object (stdClass) # 4 (2) {["Mailbox"] = & gt; String (5) "email" ["host"] = & gt; String (11) "example.com"}}
Comments
Post a Comment