PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Dec 17, 2017 12:31 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: HTTP regex
PostPosted: Thu Dec 04, 2014 12:37 pm 
Offline
Forum Newbie

Joined: Thu Dec 04, 2014 12:10 pm
Posts: 3
hello members, I am a new regex student and it is very challenging to me I have a very important question to ask about regex.
I am actively looking for an answer about this please help me
Thanks


Please verify that the following regex will correctly test that the input data is a well-formed HTTP request.

"(?i)\\A(\\x20|\\t)*(([A-Z]|[A-Z]-?|[A-Z]_?){2,19}[A-Z])(\\x20|\\t)++.+(\\x20|\\t)++HTTP\\x2F1\\x2E(0|1)(\\x20|\\t)*"

What are its limitations?


Alain


Top
 Profile  
 
 Post subject: Re: HTTP regex
PostPosted: Thu Dec 04, 2014 2:01 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6611
Location: WA, USA
Protip: use single quotes for regex strings so you don't have to escape all those backslashes.

"Correctly" according to what? It doesn't follow the RFC, if that's what you're asking. 2616 if you want to check it out - start at section 5.1.


Top
 Profile  
 
 Post subject: Re: HTTP regex
PostPosted: Thu Dec 04, 2014 2:18 pm 
Offline
Forum Newbie

Joined: Thu Dec 04, 2014 12:10 pm
Posts: 3
Hello requinix,

Thanks for your reply, i read about rfc2616 section 5.1. but not understood it
I need to:
verify that the following regex will correctly test that the input data is a well-formed HTTP request.
"(?i)\\A(\\x20|\\t)*(([A-Z]|[A-Z]-?|[A-Z]_?){2,19}[A-Z])(\\x20|\\t)++.+(\\x20|\\t)++HTTP\\x2F1\\x2E(0|1)(\\x20|\\t)*"
and what are the limitations


Top
 Profile  
 
 Post subject: Re: HTTP regex
PostPosted: Thu Dec 04, 2014 4:52 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6611
Location: WA, USA
Then let me quote myself:
requinix wrote:
"Correctly" according to what? It doesn't follow the RFC, if that's what you're asking.

As far as I'm concerned, no it does not do it correctly, and its limitations are all to do with the fact that it is incorrect.

Maybe you're looking for an explanation of how the regex works?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group