From: Brian Candler Date: 2007-03-11T03:12:24+09:00 Subject: Re: A couple of questions from a Ruby neophyte On Sun, Mar 11, 2007 at 02:32:13AM +0900, M. Edward (Ed) Borasky 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. I don't know if all the differences are documented anywhere, but the one which bit me was that ^ and $ do not match only start and end of string, but also start and end of line within a string. So if you want to safely validate an entire string against a pattern, use /\A...\z/ not /^...$/ The regexp modifiers are different too. If I remember rightly, Ruby /../ acts like Perl /../m. And if you write /../m in Ruby, it's like Perl /../ms (or it could be the other way round :-) Regards, Brian.