Compatibility in regexps between perl and ruby

Hello,
I try to translate some perl to ruby and assumed so far that the regexps are
compatible. But it seems that there are some only available in perl.
Is there something comparable to
(?<!...)
also in ruby (is a zerowidth lookbehind, so
/(?<!test)moin/ would only match moin if no test preceeds.

Regards,
Tammo

Hi,

You are right: the zerowidth lookbehind isn't still implemented in
Ruby 1.8. We have to wait for the new engine "oniguruma", and the 1.9
version.

You can install oniguruma as a gem in Ruby 1.8.

Come

···

On 8 sep, 11:10, Tammo Tjarks <ta...@tammo-tjarks.de> wrote:

Hello,
I try to translate some perl to ruby and assumed so far that the regexps are
compatible. But it seems that there are some only available in perl.
Is there something comparable to
(?<!...)
also in ruby (is a zerowidth lookbehind, so
/(?<!test)moin/ would only match moin if no test preceeds.

Regards,
Tammo

Tammo Tjarks wrote:

Hello,
I try to translate some perl to ruby and assumed so far that the regexps are
compatible. But it seems that there are some only available in perl.
Is there something comparable to
(?<!...)
also in ruby (is a zerowidth lookbehind, so
/(?<!test)moin/ would only match moin if no test preceeds.

Regards,
Tammo

···

--
    
Email and shopping with the feelgood factor!
55% of income to good causes. http://www.ippimail.com

Hi,

thanks for the quick answer, does "oniguruma" support all regexps of perl?
I stumbled over another one, where ?(..) is used, where .. is some check ( a
number). It referes to the revious matches and matches the following
expression only if the expression in the by .. given has matched.
E.g.
/(foo) (\() (\+) ?(2) (\))/
matches the closing ) only if a opening occured (referes to the matching in
the second (..)

Best regards,
Tammo

come wrote:

···

Hi,

You are right: the zerowidth lookbehind isn't still implemented in
Ruby 1.8. We have to wait for the new engine "oniguruma", and the 1.9
version.

You can install oniguruma as a gem in Ruby 1.8.

Come

On 8 sep, 11:10, Tammo Tjarks <ta...@tammo-tjarks.de> wrote:

Hello,
I try to translate some perl to ruby and assumed so far that the regexps
are compatible. But it seems that there are some only available in perl.
Is there something comparable to
(?<!...)
also in ruby (is a zerowidth lookbehind, so
/(?<!test)moin/ would only match moin if no test preceeds.

Regards,
Tammo

Will it be default in the next version?

···

--
Bernardo Rufino

Oniguruma is the default engine in Ruby 1.9, and presumably for
subsequent versions as well.

···

On 9/8/07, Bernardo Monteiro Rufino <bermonruf@gmail.com> wrote:

Will it be default in the next version?

Tammo Tjarks wrote:

Hi,

thanks for the quick answer, does "oniguruma" support all regexps of
perl?

It does not support the experimental features like using code inside a
regular expression.
The Oniguruma features are described in

http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt

Wolfgang Nádasi-Donner

···

--
Posted via http://www.ruby-forum.com/\.