From: Mike Stok Date: 2002-11-01T04:00:51+09:00 Subject: Re: mathing space in regexp In article , Maur�cio wrote: > Hi, > > If I use the option x in a regular expression, spaces are eliminated > from regexps (like /1 2 3 4 5/x). If I do so, how can I math spaces > without mathing \n? You can escape a space in the regular expression to indicate that it is being used for matching rather than layout e.g. mike@ratdog rh8.0 $ irb irb(main):001:0> '12345' =~ /1 2 3 4 5/x 0 irb(main):002:0> '123 45' =~ /1 2 3 4 5/x nil irb(main):003:0> '123 45' =~ /1 2 3\ 4 5/x 0 Hope this helps, Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60 http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA