On Mon, Jul 31, 2006 at 06:51:35AM +0900, Esteban Manchado VeláÛquez wrote: > > But you're probably better off using regular expressions instead of fixed > indices: > > "#ip 127.0.0.1".sub(/^#ip\s+/, '') # => "127.0.0.1" > > That is, "remove, from the beginning of the line, '#ip' followed by one or > more space characters (be them spaces, tabs or whatever)". If you don't know > regular expressions, _and_ you're into text processing, I recommend you to go > and read some book about regular expressions and practice a little (under > Linux there are a couple of handy utilities for that; I'm sure there must be > also for other platforms). Actually, the best text I've ever had the pleasure to read for learning regex syntax from scratch was Learning Perl. The downside is that you kinda have to know some Perl for it to make much sense (or go through the entire book and learn regular expressions as a part of learning Perl) -- which is only a downside if you don't want to learn Perl, of course. It's a reasonably easy book to work through, though, and great at what it does. All else being equal, it's better to know more languages anyway. If there are some really good materials for regexen that are specific to Ruby, of course, that may be more what you need -- but I don't know of any off the top of my head. Obviously, several of the available e-books and tutorials you can find online address regex usage, but as far as I've seen they don't tend to do as good a job of it as Learning Perl. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] "There comes a time in the history of any project when it becomes necessary to shoot the engineers and begin production." - MacUser, November 1990