That depends on the Ruby distribution you are using. If you're on 1.9*
then many of those features are supported.
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.
<soapbox>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.</soapbox>
Kind regards
robert
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