2008/3/25, Robert Klemme <shortcutter / googlemail.com>:
> 2008/3/25, Iñaki Baz Castillo <ibc / aliax.net>:
>
> > Hi, I'm trying to extract a num from a string. This string is in fact
>  >  some number of headers separated by \r\n or \n. for now I just need to
>  >  extract the value of "Content-Length" (case insensitive) header.
>
>
> Why don't you use Net::Http?  IIRC this gives you individual header
>  fields already.

Yes, but I'm doing a parser for SIP protocol (similar to HTTP but not the same).



> headers[/content-length:\s*(\d+)/i, 1].to_i

Great !

Thanks.


-- 
Iñaki Baz Castillo
<ibc / aliax.net>