From: "Iñaki Baz Castillo" Date: 2008-03-26T01:28:32+09:00 Subject: Re: Help parsing and extracting a num > 2008/3/25, Robert Klemme : > > headers[/content-length:\s*(\d+)/i, 1].to_i There is a small issue here that I can't solve. Imagine there is "Content-Length" header bt with empty value, and the next header has a numeric header name: ------- Content-Length: 1234: blablabla ------- In that case the code above returns 1234 while it should return 0. Demostration: "Via: via1,via2,\r\n via3\r\nFrom: from_user@domain\nContent-length: \r\n1234: blabla\nTo: to_user@domain\n"[/content-length\s*:\s*(\d+)/i, 1].to_i => 1234 I'm trying to solve it by ading [^(\r|\n)] after (\d+) but I get nothing. Please, could you help me with this? Thanks a lot in advance and best regards. -- Iñaki Baz Castillo