From: "Hal E. Fulton" Date: 2003-07-10T14:31:07+09:00 Subject: Re: Ruby T-Shirt Idea ----- Original Message ----- From: "Daniel Carrera" To: "ruby-talk ML" Sent: Thursday, July 10, 2003 12:27 AM Subject: Re: Ruby T-Shirt Idea > I just thought of a dead give-away: > > dcarrera ~ $ cat myfile > cat > dog > horse > zebra > tiger > dcarrera ~ $ grep a myfile > cat > zebra > dcarrera ~ $ ruby -e 'puts ARGF.grep(/a/)' myfile > cat > zebra Quite right. The part I can't remember was one of those "implicit loop" things that I never use... BTW, var = Regexp.new(Regexp.escape(var)) will also do that conversion... probably more than two ways... ;) As for interpolating a variable into a regex, I'm not sure whether it does automatic escaping or not. I'd like to think it does, but there may be some good reason it doesn't. Too lazy to test right now... Hal -- Hal Fulton hal9000@hypermetrics.com