From: Niklas Frykholm Date: 2001-11-15T02:38:53+09:00 Subject: [ruby-talk:25203] Re: Linux Magazine article [Niklas Frykholm] >>> Indexing strings by regexps [Jos Backus] >> This sounds interesting. Can you give an example please? [HarryO] > 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. You can also do s[/f.*r/] = "lizard ducks under" p s // Niklas