From: Nikolai Weibull Date: 2005-11-27T08:47:08+09:00 Subject: Re: String#to_rx ? Trans wrote: > Could you give us a summary of how it would apply. I really don't have > time to weed through all that material. There are two possible solutions as I see it that make more sense than #to_rx: a) strings are interpreted as just that - strings of symbols that you want to interpret literally and b) add syntax to allow you to easily embed strings inside a regular expression. In Perl 6, the suggestion is to interpret $string as a string and <$string> as a regular expression. In Ruby that'd be #{string} and <#{string}>, I suppose. (#{regex} would still mean what it means today in both cases.) Another thing that'd be nice to have is a way to insert literal strings directly, e.g., /<'common regex operators include *, ?, and .'>/, where <'...'> is syntax for a literal string. A way to embedd a string variable would then perhaps be /<'#{var}'>/, but I think that the solution in the previous paragraph may make more sense. I'm probably not making myself clear enough, but if what I'm saying seems interesting I'd suggest you at least read "Synopsis 5" [1]. nikolai [1] http://www.perl.com/pub/a/2002/06/26/synopsis5.html -- Nikolai Weibull: now available free of charge at http://bitwi.se/! Born in Chicago, IL USA; currently residing in Gothenburg, Sweden. main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}