From: Harry Date: 2009-09-19T21:25:24+09:00 Subject: Re: Newbie: Are Ruby regexp's a subset, superset, or equal to Perl's? On Sep 19, 2:57 pm, Robert Klemme wrote: > On 18.09.2009 21:08, Harry wrote: > > > Does Ruby 1.9 explicitly support the _full_ regexp flavor of Perl > > 5.10? Specifically, things like... look-around assertions, extended / > > That depends on the Ruby distribution you are using.  If you're on 1.9* > then many of those features are supported. > > > experimental Perl regexp features such as "(?{ code })"  and "(?? > > { code })" . > > Ruby's RX engine won't execute any code embedded in the expression > AFAIK.  I second Fabian: look at the docs. > > But one thing is sure: you cannot expect to copy a Perl regexp over to > Ruby and use it as before, especially if advanced features are used. > > Personally I did not have the need for embedded code in regular > expressions yet.  If your pattern matching becomes that complex, chances > are that a different approach (e.g. code /outside/ the rx) is better > maintainable.  My impression is that Perl has a tendency to include more > and more obscure features which makes it less and less readable over > time.  When I used it on a daily basis I was pretty fluent but nowadays > looking at Perl code gives me the creeps. > > Kind regards > >         robert > > -- > remember.guy do |as, often| as.you_can - without endhttp://blog.rubybestpractices.com/ Thanks, Robert. And, Fabian too... for the taking the time to reply! Robert, I fully agree with your 'soapbox' content above. I use Perl mostly for my text processing needs, and am seriously considering switching to Ruby, mainly for the latter's elegance and simplicity overall. I admit, I have absolutely no practical need to use any of those experimental portions of Perl regexp as of today. However, just the thought that they are there in your new language for your use if and when you need them can be very comforting indeed. Hence the question. Anyways, I'll manage without 'em for now. An appeal to Ruby Development Team: If Perl has no patent over its regexp spec (I believe Perl is completely free), then the Ruby Development Team should simply lift wholesale the whole blessed regexp spec out of Perl (including the code) and support it in Ruby. I'm sure Rubyists in general would welcome this. Basically: If you don't need something, just don't use it; however, it's available for the rest. Best regards, /HS