Ruby regexp spec. (was: OT: Regexp buddy)

Speaking of learning regexps for ruby, is there somewhere a
comprehensive list of just what syntax ruby’s regular expression
engine does and doesn’t support? I can’t find any documentation, for
example, that shows that ruby’s regexp engine supports perl’s “don’t
backtrack” notation (?>pat), but that it does not support the
“look-behind” features found in perl, python, and java’s regular
expression engines.

I mean, I suppose I can go and try ever construct mentioned in perlre
in irb and see what happens, but it’d be nice if the documentation
existed somewhere.

On 7/11/06, Daniel M. [email protected] wrote:

existed somewhere.
Have a look here:

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

“Simon S.” [email protected] writes:

Have a look here:

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

That’s nice, but it doesn’t document ruby’s Regexp engine, at least
not the one in Ruby 1.8.4; the document says:

(?<=subexp) look-behind

But:

irb(main):032:0> Regexp.new(’(?<=abc)’)
RegexpError: undefined (?..) sequence: /(?<=abc)/
from (irb):32:in `initialize’
from (irb):32
from :0

I suspect that this documents what will be, in the Ruby 2.0 that’s
going to have easy built-in support for unicode in all its glory.

That still leaves the current engine undocumented.

On Jul 11, 2006, at 2:12 PM, Daniel M. wrote:

That still leaves the current engine undocumented.

Section A-4 of the above document tells you the differences between
the new regexp engine and the current one. You could do a mental diff

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs