From: Brian Candler Date: 2007-03-11T05:17:24+09:00 Subject: Re: A couple of questions from a Ruby neophyte On Sun, Mar 11, 2007 at 04:42:19AM +0900, Chad Perrin wrote: > > This is probably a FAQ, but just how different *are* Perl and Ruby regex > > capabilities? I'm not a heavy regex user by any stretch of the > > imagination. I do the basic stuff that will work anywhere (original > > "vi", "grep", "sed", "awk") so Perl and Ruby are overkill for me. > > For the most part, they're pretty similar. There are a few differences > that can trip you up, though -- for instance, in Ruby this works for > matching either foo or bar: > > /foo|bar/ > > . . . whereas in Perl you'd need to do this: > > /(foo|bar)/ Really? $ perl -e '$_ = "abcfoodef"; print "match!\n" if /foo|bar/' match! $ perl -v | head -3 This is perl, v5.8.7 built for i486-linux-gnu-thread-multi (with 1 registered patch, see perl -V for more detail)