From: William James Date: 2005-08-14T13:11:12+09:00 Subject: Re: YANQ (yet another newbie question): "string"[0.."e"] basi wrote: > Hello, > > Is there a way to say in Ruby: > > "astring"[0../r/] #"ast" > "astring"[/ast/..-1] #"ring" > > In other words, indexing using a "pattern". > > Thanks, > basi "astring"[/.*?(?=r)/] --> "ast" "astring"[/(.*?)r/,1] --> "ast" "astring"[/ast(.*)/,1] --> "ring"