From: Austin Ziegler Date: 2006-07-06T02:48:30+09:00 Subject: Re: Find Position of text On 7/5/06, j3n7il jones wrote: > Im trying to recreate a function I had in Delphi for ruby, but cannot > figure out how to search for a string withn a string You probably don't want to do it the way you're doing it now. a = "abcdef" a.sub(/cd/, "xy") # non-destructive, returns a new string But to your question, =~ works quite well for "pos", as does #index: a =~ /cd/ # returns 2 a.index("cd") There's a *lot* more to strings and regexen than Pascal ever dreamed. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca