From: dblack@... Date: 2003-09-13T09:42:54+09:00 Subject: Re: String#start_with? / #end_with? Hi -- On Sat, 13 Sep 2003, Mark Wilson wrote: > > On Friday, September 12, 2003, at 05:20 PM, Philip Mak wrote: > > > [snip] > > class String > > def start_with?(little_string) > !self.match(/^#{Regexp.escape(little_string)}/).nil? > end > > end > > > [snip] > > > > big_string.start_with?(little_string) All of the snippets in this thread will run aground on the fact that ^ anchors to start-of-line, not start-of-string. You'd want to use the \A anchor for the latter. David -- David Alan Black home: dblack@superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav