For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2008 > How to read an rfc spec









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to read an rfc spec
2apart

2008-01-27, 10:09 pm

Here's a little section from rfc 2822. I know what the nemonics stand
for, but
I'm not sure how to read the spec, * [] () / what do they mean.
If you have a handle on this could you translate the CFWS spec. It
seems
to contain all the code except the quote "
Thanks.

FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space
obs-FWS

ctext = NO-WS-CTL / ; Non white space controls

%d33-39 / ; The rest of the US-ASCII
%d42-91 / ; characters not including
"(",
%d93-126 ; ")", or "\"

ccontent = ctext / quoted-pair / comment

comment = "(" *([FWS] ccontent) [FWS] ")"

CFWS = *([FWS] comment) (([FWS] comment) / FWS)

Gunnar Hjalmarsson

2008-01-27, 10:09 pm

2apart wrote:
>
> Subject: How to read an rfc spec


What has your question to do with Perl?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Rob Dixon

2008-01-27, 10:09 pm

2apart wrote:
>
> Here's a little section from rfc 2822. I know what the nemonics stand
> for, but
> I'm not sure how to read the spec, * [] () / what do they mean.
> If you have a handle on this could you translate the CFWS spec. It
> seems
> to contain all the code except the quote "
> Thanks.
>
> FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space
> obs-FWS
>
> ctext = NO-WS-CTL / ; Non white space controls
>
> %d33-39 / ; The rest of the US-ASCII
> %d42-91 / ; characters not including
> "(",
> %d93-126 ; ")", or "\"
>
> ccontent = ctext / quoted-pair / comment
>
> comment = "(" *([FWS] ccontent) [FWS] ")"
>
> CFWS = *([FWS] comment) (([FWS] comment) / FWS)


This question is both irrelevant to the Perl language and very lazy.
RFC2822 is a specification for Internet text messages, and itself
states:

1.2.2. Syntactic notation

This standard uses the Augmented Backus-Naur Form (ABNF) notation
specified in [RFC2234] for the formal definitions of the syntax of
messages.

Rob
2apart

2008-01-28, 7:11 pm

On Jan 27, 7:21 pm, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote:
> 2apart wrote:
>
>
> What has your question to do with Perl?
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl


What does yours? ;-)

2apart

2008-01-28, 7:11 pm


> This question is both irrelevant to the Perl language and very lazy.
> RFC2822 is a specification for Internet text messages, and itself


You guys just love to scold... guys? Are you female? :-)

> 1.2.2. Syntactic notation
>
> This standard uses the Augmented Backus-Naur Form (ABNF) notation
> specified in [RFC2234] for the formal definitions of the syntax of
> messages.
>
> Rob


Yes, I read that. I was just hoping someone might translate a line or
two gratis.
Forgot I was in a perl group. Thanks for the advice.


Dr.Ruud

2008-01-28, 7:11 pm

2apart schreef:

> Here's a little section from rfc 2822. I know what the nemonics stand
> for, but
> I'm not sure how to read the spec


Look at the end of http://www.perlmonks.org/?node_id=603647

--
Affijn, Ruud

"Gewoon is een tijger."

Tom Phoenix

2008-01-28, 7:11 pm

On Jan 28, 2008 7:53 AM, 2apart <drubnone@yahoo.com> wrote:

> You guys just love to scold...


Nobody scolded you because of the love of scolding; don't pretend otherwise.

Keeping a forum on-topic is everyone's duty. Answers will be faster
and more reliable when the questions are posted to the correct forum.

Cheers!

--Tom Phoenix
Stonehenge Perl Training
asmith9983@gmail.com

2008-01-28, 10:08 pm

Hi everyone
It cost nothing to be polite and only a few seconds to be helpful. I was
myself looking at RFC822 a few days ago to try to figure out what headers
should be in an
email message I bounce with my Perl re-wtite script from a procmail recipe.
Secret formats and being generally unhelpful are a M$ trait, not to be cloned.
--
Andrew in Edinburgh,Scotland.

On Mon, 28 Jan 2008, 2apart wrote:

>
>
> You guys just love to scold... guys? Are you female? :-)
>
>
> Yes, I read that. I was just hoping someone might translate a line or
> two gratis.
> Forgot I was in a perl group. Thanks for the advice.
>
>
>
>

wardbayern@yahoo.com

2008-01-29, 10:09 pm

On Jan 28, 2:27 pm, asmith9...@gmail.com wrote:
> Hi everyone
> It cost nothing to be polite and only a few seconds to be helpful. I was
> myself looking at RFC822 a few days ago to try to figure out what headers
> should be in an
> email message I bounce with my Perl re-wtite script from a procmail recipe.
> Secret formats and being generally unhelpful are a M$ trait, not to be cloned.
> --
> Andrew in Edinburgh,Scotland.

And to close the issue.

Was looking for info on the email RFC too and ran into this.

http://www.regular-expressions.info/email.html

and the "final" word on the matter. Do read what he has to say but
here is the monster regx

$emailx = qr((?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?
^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\
[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?
[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-
z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-
\x09\x0b\x0c\x0e-\x7f])+)\]));

master regular expressions has a .pl that builds this up, in a modular
way, with comments. Find it here:

http://examples.oreilly.de/english_examples/regex/

ps 2apart. I'm lazy too. Ignore posts like that. Some have legit
concerns that the group will get out of hand. Most, however, are
bored. This is not a political group or alt.hvac. I'd never go out
of my way to say something like that.

Jeff Pang

2008-01-29, 10:09 pm



-----Original Message-----
>From: wardbayern@yahoo.com
>Sent: Jan 30, 2008 4:58 AM
>To: beginners@perl.org
>Subject: Re: How to read an rfc spec
>
>On Jan 28, 2:27 pm, asmith9...@gmail.com wrote:
>And to close the issue.
>
>Was looking for info on the email RFC too and ran into this.
>
>http://www.regular-expressions.info/email.html
>
>and the "final" word on the matter. Do read what he has to say but
>here is the monster regx
>
>$emailx = qr((?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?
>^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\
>[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
>\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?
>[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-
>z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-
>\x09\x0b\x0c\x0e-\x7f])+)\]));
>



This RE is not perfect as it was said on this list.
You may use a module from CPAN instead:

http://search.cpan.org/~rjbs/Email-.../Email/Valid.pm

EXAMPLES ^

Let's see if the address 'maurice@hevanet.com' conforms to the RFC822 specification:

print (Email::Valid->address('maurice@hevanet.com') ? 'yes' : 'no');

--
Jeff Pang - pangj@earthlink.net
http://home.arcor.de/jeffpang/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com