From: Harry Kakueki Date: 2010-03-30T12:18:11+09:00 Subject: Re: return number of spaces at the beginning of a line On Tue, Mar 30, 2010 at 11:41 AM, Jesse B. wrote: > How would I find the number of spaces at the beginning of a line before > the occurrance of the first non-space character? > > Would the best method be to use a regular expression that covers all > non-space characters and get the index of the first occurrance of that? > -- If I understand your question correctly, str = " hello" p str =~ /\S/ Harry