Regex help for email

Regex help for email

am 18.10.2007 16:59:31 von gezerpunta

Hi

I need a regex code for parsing this string to an email array

"mnp test" ,"test testt"
,sett@tttt.com,test@twest.com

thanks

Re: Regex help for email

am 18.10.2007 19:10:00 von zeldorblat

On Oct 18, 10:59 am, gezerpunta wrote:
> Hi
>
> I need a regex code for parsing this string to an email array
>
> "mnp test" ,"test testt"
> ,s...@tttt.com,t...@twest.com
>
> thanks

Why do you need a regex? Why not just use explode?

Re: Regex help for email

am 21.10.2007 15:39:17 von AnrDaemon

Greetings, ZeldorBlat.
In reply to Your message dated Thursday, October 18, 2007, 21:10:00,

Z> On Oct 18, 10:59 am, gezerpunta wrote:
>> Hi
>>
>> I need a regex code for parsing this string to an email array
>>
>> "mnp test" ,"test testt"
>> ,s...@tttt.com,t...@twest.com
>>
>> thanks

Z> Why do you need a regex? Why not just use explode?

Z>

Please, provide code with explode() to put string
"mnp test" ,"test testt" ,s...@tttt.com,t...@twest.com
into
array('c...@tum.com', 'o...@par.com', 's...@tttt.com', 't...@twest.com');


--
Sincerely Yours, AnrDaemon

Re: Regex help for email

am 21.10.2007 15:56:33 von AnrDaemon

Greetings, gezerpunta.
In reply to Your message dated Thursday, October 18, 2007, 18:59:31,

g> I need a regex code for parsing this string to an email array

g> "mnp test" ,"test testt"
g> ,sett@tttt.com,test@twest.com

Something like


$s = '"mnp test" ,"test testt" , sett@tttt.com,test@twest.com';

if(preg_match_all('#[\s\,]?#xi', $s, $ta))
{
var_export($ta[1]);
}

?>


--
Sincerely Yours, AnrDaemon

This one better I think. (Re: Regex help for email)

am 21.10.2007 16:00:56 von AnrDaemon

Greetings, gezerpunta.
In reply to Your message dated Thursday, October 18, 2007, 18:59:31,


$s = 'celo@tum.com, "mnp test" ,"test testt" , sett@tttt.com,test@twest.com';

if(preg_match_all('#(?:^|[\s\,])?#xi', $s, $ta))
{
var_export($ta[1]);
}

?>


--
Sincerely Yours, AnrDaemon

Re: This one better I think. (Re: Regex help for email)

am 22.10.2007 18:53:00 von Steve

"AnrDaemon" wrote in message
news:1979714934.20071021180056@freemail.ru...
> Greetings, gezerpunta.
> In reply to Your message dated Thursday, October 18, 2007, 18:59:31,
>
> >
> $s = 'celo@tum.com, "mnp test" ,"test testt" ,
> sett@tttt.com,test@twest.com';
>
> if(preg_match_all('#(?:^|[\s\,])?#xi',
> $s, $ta))
> {
> var_export($ta[1]);
> }

of course you would. however, notice that whatever your prowess at regex,
you lack understanding of the basic email conventions explained in the
rfc(s). your preg doesn't allow for atomic account names. ;^)

hmmmm...this *does* (and then some).

function isEmail($email)
{
if (!$email){ return false; }
$pattern =
"/^((\"[^\"]*?\")|([^\(\)\<\> \@\,\;\:\\\"\[\]\s\*\/]+))@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0 -9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z ]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$ /si";
return preg_match($pattern, $email);
}

the pattern above simply needs to be applied to the entire string, and you
get what you want.

Re: This one better I think. (Re: Regex help for email)

am 24.10.2007 15:46:13 von AnrDaemon

Greetings, Steve.
In reply to Your message dated Monday, October 22, 2007, 20:53:00,


S> "AnrDaemon" wrote in message
S> news:1979714934.20071021180056@freemail.ru...
>> Greetings, gezerpunta.
>> In reply to Your message dated Thursday, October 18, 2007, 18:59:31,
>>
>> >>
>> $s = 'celo@tum.com, "mnp test" ,"test testt" ,
>> sett@tttt.com,test@twest.com';
>>
>> if(preg_match_all('#(?:^|[\s\,])?#xi',
>> $s, $ta))
>> {
>> var_export($ta[1]);
>> }

S> of course you would. however, notice that whatever your prowess at regex,
S> you lack understanding of the basic email conventions explained in the
S> rfc(s). your preg doesn't allow for atomic account names. ;^)

Example please?
What You mean "atomic account names"?


--
Sincerely Yours, AnrDaemon

Re: This one better I think. (Re: Regex help for email)

am 24.10.2007 19:34:41 von Steve

"AnrDaemon" wrote in message
news:1805468620.20071024174613@freemail.ru...
> Greetings, Steve.
> In reply to Your message dated Monday, October 22, 2007, 20:53:00,
>
>
> S> "AnrDaemon" wrote in message
> S> news:1979714934.20071021180056@freemail.ru...
>>> Greetings, gezerpunta.
>>> In reply to Your message dated Thursday, October 18, 2007, 18:59:31,
>>>
>>> >>>
>>> $s = 'celo@tum.com, "mnp test" ,"test testt"
>>> ,
>>> sett@tttt.com,test@twest.com';
>>>
>>> if(preg_match_all('#(?:^|[\s\,])?#xi',
>>> $s, $ta))
>>> {
>>> var_export($ta[1]);
>>> }
>
> S> of course you would. however, notice that whatever your prowess at
> regex,
> S> you lack understanding of the basic email conventions explained in the
> S> rfc(s). your preg doesn't allow for atomic account names. ;^)
>
> Example please?

read the freaking email rfc(s).

> What You mean "atomic account names"?

hmmmm, what do you think?

the rfc's allow for 'illegal' characters in account names as long as they're
encapsulated. this is to compensate for non-latin character sets
(particularly, non-english sets). is that ringing a bell?

Re: This one better I think. (Re: Regex help for email)

am 25.10.2007 00:58:51 von AnrDaemon

Greetings, Steve.
In reply to Your message dated Wednesday, October 24, 2007, 21:34:41,

>>>> >>>>
>>>> $s = 'celo@tum.com, "mnp test" ,"test testt"
>>>> ,
>>>> sett@tttt.com,test@twest.com';
>>>>
>>>> if(preg_match_all('#(?:^|[\s\,])?#xi',
>>>> $s, $ta))
>>>> {
>>>> var_export($ta[1]);
>>>> }
>>
>> S> of course you would. however, notice that whatever your prowess at
>> regex,
>> S> you lack understanding of the basic email conventions explained in the
>> S> rfc(s). your preg doesn't allow for atomic account names. ;^)
>>
>> Example please?

S> read the freaking email rfc(s).

Do it for me, please.

>> What You mean "atomic account names"?

S> hmmmm, what do you think?

S> the rfc's allow for 'illegal' characters in account names as long as they're
S> encapsulated. this is to compensate for non-latin character sets
S> (particularly, non-english sets). is that ringing a bell?

Never saw any in 10 years. And I think I'll never see.
Not all what allowed by RFC is acceptable by real ISP's.
Typical rules I see around the world:
(?i)^[a-z][0-9a-z]*(?:[\.\-\_][0-9a-z]+)*$


--
Sincerely Yours, AnrDaemon

Re: This one better I think. (Re: Regex help for email)

am 25.10.2007 06:41:57 von Steve

"AnrDaemon" wrote in message
news:902856077.20071025025851@freemail.ru...
> Greetings, Steve.
> In reply to Your message dated Wednesday, October 24, 2007, 21:34:41,
>
>>>>> >>>>>
>>>>> $s = 'celo@tum.com, "mnp test" ,"test testt"
>>>>> ,
>>>>> sett@tttt.com,test@twest.com';
>>>>>
>>>>> if(preg_match_all('#(?:^|[\s\,])?#xi',
>>>>> $s, $ta))
>>>>> {
>>>>> var_export($ta[1]);
>>>>> }
>>>
>>> S> of course you would. however, notice that whatever your prowess at
>>> regex,
>>> S> you lack understanding of the basic email conventions explained in
>>> the
>>> S> rfc(s). your preg doesn't allow for atomic account names. ;^)
>>>
>>> Example please?
>
> S> read the freaking email rfc(s).
>
> Do it for me, please.

WTF?!!! i read it for me...and those that pay me. you may continue to be
lazy at your liesure.

>>> What You mean "atomic account names"?
>
> S> hmmmm, what do you think?
>
> S> the rfc's allow for 'illegal' characters in account names as long as
> they're
> S> encapsulated. this is to compensate for non-latin character sets
> S> (particularly, non-english sets). is that ringing a bell?
>
> Never saw any in 10 years.

and you speak english and type with a 'normal' keyboard. now, for the
chinese, japanese, etc. people out there...well, you should get the point.
hell, even this plain english account is valid:

"oops, there's spaces and commas and shit"@example.com

get the picture, cupcake?

> And I think I'll never see.

good for you. glad you feel that way. that doesn't change the fact that
email rfc standards define and allow for it.

> Not all what allowed by RFC is acceptable by real ISP's.

uhmmmm...'real' isp? hmmmm, what would a 'fake' isp look like i wonder?
maybe like the sprint commercials where 'the other guy's network' is a bunch
of propped up pictures of people. can you hear me now? ROFLMAO!

ok, nimrod...why not quantify and qualify that statement so no one here
thinks you're just talking outta your ass.

which isp does NOT support which rfc standard(s)?

since you haven't even READ ONE SINGLE email rfc, i doubt you can back
yourself up...save, to backpeddle.

> Typical rules I see around the world:
> (?i)^[a-z][0-9a-z]*(?:[\.\-\_][0-9a-z]+)*$

that's because you're viewing the world through your ass. RTFM.

> Sincerely Yours,

i don't want you...unless returning you means i can get a refund!

run along now.

Re: This one better I think. (Re: Regex help for email)

am 25.10.2007 17:20:23 von Michael Fesser

..oO(AnrDaemon)

>Greetings, Steve.
>In reply to Your message dated Wednesday, October 24, 2007, 21:34:41,
>
>S> the rfc's allow for 'illegal' characters in account names as long as they're
>S> encapsulated. this is to compensate for non-latin character sets
>S> (particularly, non-english sets). is that ringing a bell?
>
>Never saw any in 10 years. And I think I'll never see.
>Not all what allowed by RFC is acceptable by real ISP's.

It's also not acceptable to improperly mark quoted lines in a reply,
because it makes the postings very hard to read. The Usenet way is a
single '>', so please adjust your newsreader. I think I've already
mentioned that.

Micha

Re: This one better I think. (Re: Regex help for email)

am 26.10.2007 00:46:44 von Steve

"Michael Fesser" wrote in message
news:4qc1i3d2vntr22fevc8nrc08f0d4sai5a4@4ax.com...
> .oO(AnrDaemon)
>
>>Greetings, Steve.
>>In reply to Your message dated Wednesday, October 24, 2007, 21:34:41,
>>
>>S> the rfc's allow for 'illegal' characters in account names as long as
>>they're
>>S> encapsulated. this is to compensate for non-latin character sets
>>S> (particularly, non-english sets). is that ringing a bell?
>>
>>Never saw any in 10 years. And I think I'll never see.
>>Not all what allowed by RFC is acceptable by real ISP's.
>
> It's also not acceptable to improperly mark quoted lines in a reply,
> because it makes the postings very hard to read. The Usenet way is a
> single '>', so please adjust your newsreader. I think I've already
> mentioned that.

i've been biting my tongue on that one so i could stay on topic with the
regex. thanks for pointing that out.

cheers.

Re: This one better I think. (Re: Regex help for email)

am 26.10.2007 00:54:43 von Michael Fesser

..oO(Steve)

>"Michael Fesser" wrote
>>
>> It's also not acceptable to improperly mark quoted lines in a reply,
>> because it makes the postings very hard to read. The Usenet way is a
>> single '>', so please adjust your newsreader. I think I've already
>> mentioned that.
>
>i've been biting my tongue on that one so i could stay on topic with the
>regex. thanks for pointing that out.

I've bitten my tongue too often. ;-)

Micha

Re: This one better I think. (Re: Regex help for email)

am 26.10.2007 01:31:03 von Steve

"Michael Fesser" wrote in message
news:ag72i31no70j3bg822aivmi9g741iqm7hs@4ax.com...
> .oO(Steve)
>
>>"Michael Fesser" wrote
>>>
>>> It's also not acceptable to improperly mark quoted lines in a reply,
>>> because it makes the postings very hard to read. The Usenet way is a
>>> single '>', so please adjust your newsreader. I think I've already
>>> mentioned that.
>>
>>i've been biting my tongue on that one so i could stay on topic with the
>>regex. thanks for pointing that out.
>
> I've bitten my tongue too often. ;-)

i actually used to use a non-standard delimiter b/c it made things more
readable in my newsreader. after you quite nicely asked if i'd change it for
the benefit of all, we have the end result.

i think you can give yourself a break on this subject - your tongue anyway.
:)

Re: This one better I think. (Re: Regex help for email)

am 26.10.2007 01:56:15 von Michael Fesser

..oO(Steve)

>"Michael Fesser" wrote
>>
>> I've bitten my tongue too often. ;-)
>
>i actually used to use a non-standard delimiter b/c it made things more
>readable in my newsreader. after you quite nicely asked if i'd change it for
>the benefit of all, we have the end result.

I can remember.

>i think you can give yourself a break on this subject - your tongue anyway.

;-)

I know about different kinds of delimiters. Some are quite common in
chatrooms and I've also used some of them years ago, but today most
newsreaders are programmed for '>' at the beginning of a line. That's
what makes a quote, like '-- ' makes a signature. It's just a common,
non-written standard, that helps to make Usenet a better place.

But this is _really_ OT here, so EOT.

Micha