On Mon, Jul 31, 2006 at 02:18:36PM +0900, Martin DeMello wrote: > On 7/31/06, Esteban Manchado VeláÛquez <zoso / foton.es> 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" > > A prettier looking form, in this case, is > > s = "#ip 127.0.0.1" > s[/^#ip /] = '' That changes the behavior of the regex, though. Maybe more like: s = "#ip 127.0.0.1" s[/^#ip\s+/] = '' . . . unless we're sure there will always be exactly one space (which is the case if 's = "#ip 127.0.0.1"' is the literal code we're using), in which case the literal space in the matching regex is appropriate. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] "The first rule of magic is simple. Don't waste your time waving your hands and hopping when a rock or a club will do." - McCloctnick the Lucid