From: Philip Mak Date: 2003-09-13T06:20:56+09:00 Subject: Re: String#start_with? / #end_with? Ryan Pavlik wrote: > "Hello world".match /^Hello/ # => MatchData > "Hello world".match /^world/ # => nil The solution for matching using regexps isn't that simple. It's more like this: "Hello world".match /^#{Regexp.escape('hello')}/ because if the substring I'm checking for contains characters that would be considered special in a regexp, then they must be escaped or else it'll cause a (possibly silent) error. So I don't like this solution so much since it essentially amounts to typing: big_string.match(/^#{Regexp.escape(little_string)}/) instead of simply: big_string.start_with?(little_string)