HTTP regex

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
alangueu
Forum Newbie
Posts: 3
Joined: Thu Dec 04, 2014 11:10 am

HTTP regex

Post by alangueu »

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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: HTTP regex

Post by requinix »

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.
alangueu
Forum Newbie
Posts: 3
Joined: Thu Dec 04, 2014 11:10 am

Re: HTTP regex

Post by alangueu »

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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: HTTP regex

Post by requinix »

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?
Post Reply