On Thu, Jul 4, 2013 at 7:59 AM, xcoder Blue_fox <lists / ruby-forum.com>wrote:

> hey Guys i need to split this query to string array how contains three
> strings :
> query = "Get /index.html HTTP/1.0\r\n\r\n"
> query += "Host: www.example.com\r\n"
> query += "Connection: Close\r\n\r\n"
> i want to get result like
> array[0] >>> Get /index.html HTTP/1.0
> array[1] >>> Host: www.example.com
> array[2] >>> Connection: Close
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
First reaction is to tell you to quit being lazy and go read the docs. Your
example practically in the docs, and you even know the name of the class
and the method. http://rdoc.info/stdlib/core/String:split

Then I realized there are two \r\n after the first line, in which case
maybe your difficulty is that you don't know how to construct the regex
that won't give you an empty line: /\r\n\r\n|\r\n/

But then I realized that there are not two \r\n after the first line of an
http request: http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1So
your query string is wrong, and I can't figure out what you're
actually
trying to do.