From: HarryO Date: 2001-11-14T23:53:30+09:00 Subject: [ruby-talk:25183] Re: Linux Magazine article In article <20011114001517.GC44028@lizzy.bugworks.com>, "Jos Backus" wrote: > On Tue, Nov 13, 2001 at 05:34:03PM +0900, Niklas Frykholm wrote: >> Indexing strings by regexps >> >> I am constantly amazed by how often this makes my code shorter AND >> more readable. > > This sounds interesting. Can you give an example please? I didn't know about it, either, but took a guess and tried this ... s = "The quick brown fox jumps over the lazy dog." p s[/f.*r/] which generates "fox jumps over". So, indexing using a regex appears to give you the first substring that matches the regular expression. Very nice, indeed!