Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

look-behind regexp ?

14 views
Skip to first unread message

Shajith

unread,
Mar 30, 2005, 8:48:18 AM3/30/05
to
Hi!
Are there any plans to support look-behinds in the core regexp engine?

I'm curious as to why we don't have it.
Thanks
Shajith

PS: I found an old request about this in the archives:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/417


Yukihiro Matsumoto

unread,
Mar 30, 2005, 8:58:08 AM3/30/05
to
Hi,

In message "Re: look-behind regexp ?"


on Wed, 30 Mar 2005 22:48:18 +0900, Shajith <deme...@gmail.com> writes:

|Are there any plans to support look-behinds in the core regexp engine?

1.9 Oniguruma regexp engine already has one.

matz.


Shajith

unread,
Mar 30, 2005, 9:11:32 AM3/30/05
to
On Wed, 30 Mar 2005 22:58:08 +0900, Yukihiro Matsumoto
<ma...@ruby-lang.org> wrote:
>
> 1.9 Oniguruma regexp engine already has one.
>
> matz.
Thanks!

Shajith


B. K. Oxley (binkley)

unread,
Mar 30, 2005, 9:44:06 AM3/30/05
to
Yukihiro Matsumoto wrote:
> Shajith <deme...@gmail.com> writes:
>> Are there any plans to support look-behinds in the core regexp
>> engine?
>
> 1.9 Oniguruma regexp engine already has one.

Where can I read more about this regexp engine? How does it compare to:

* Perl's own regexps
* regexp-engine from AEditor (http://aeditor.rubyforge.org/)
* PCRE (http://www.pcre.org/)


Thanks,
--binkley


Florian Gross

unread,
Mar 30, 2005, 10:23:36 AM3/30/05
to
B. K. Oxley (binkley) wrote:

>> 1.9 Oniguruma regexp engine already has one.
> Where can I read more about this regexp engine?

http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt seems to have a
fairly complete listing of its features.

B. K. Oxley (binkley)

unread,
Mar 30, 2005, 10:29:03 AM3/30/05
to
Florian Gross wrote:
> http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt seems to have a
> fairly complete listing of its features.

Ah, yes. Thanks. I should have Googled first. :)

But reading through that and the documentation on the same site, I am
still looking for a rationale document. Why Onigurama and not, say,
PCRE? Why a new regexp parser?


Cheers,
--binkley

Austin Ziegler

unread,
Mar 30, 2005, 10:58:39 AM3/30/05
to

1. Licensing. PCRE's licensing has been somewhat fluid. The current
release seems OK.
2. Control. In many ways, such a core feature to Ruby should be native to Ruby.
3. Native concepts. Ruby REs are a bit different because they end up
being objects.

-austin
--
Austin Ziegler * halos...@gmail.com
* Alternate: aus...@halostatue.ca


B. K. Oxley (binkley)

unread,
Mar 30, 2005, 11:03:01 AM3/30/05
to
Austin Ziegler wrote:
> 1. Licensing. PCRE's licensing has been somewhat fluid. The current
> release seems OK.
> 2. Control. In many ways, such a core feature to Ruby should be native to Ruby.
> 3. Native concepts. Ruby REs are a bit different because they end up
> being objects.

Hrm.

In all honesty, these objections seem weak to me.

If the licensing is not a problem right now, why would it necessarily
become one in the future? (Although I don't know the history of
licensing in PCRE, so perhaps it has a record of arbitrariness.)

Control is not so important when you have the source code. And Ruby can
contribute to the development of PCRE.

I'm unsure what you mean in point three. I presume that a Ruby regexp
implementation would use PCRE for implementation, wrapping any details
so that the implementation is not visible, and only objects remain.

Not to be so nitpicky, I only used PCRE as an example. I have an
inherent dislike of wheel-reinvention (my natural laziness at play), so
my ears perk up when I see something like a rewrite of regexp parsers
when so many fine ones are already around.


Cheers,
--binkley


Yukihiro Matsumoto

unread,
Mar 30, 2005, 11:05:00 AM3/30/05
to
Hi,

In message "Re: look-behind regexp ?"

on Thu, 31 Mar 2005 00:29:03 +0900, "B. K. Oxley (binkley)" <bin...@alumni.rice.edu> writes:

|But reading through that and the documentation on the same site, I am
|still looking for a rationale document. Why Onigurama and not, say,
|PCRE? Why a new regexp parser?

PCRE does only support UTF-8 (as far as I know), not multiple
encodings like Ruby does. Oniguruma supports UTF-8, UTF-16,
ISO-8859-*, EUC-JP, Shift_JIS, and lot more.

matz.


B. K. Oxley (binkley)

unread,
Mar 30, 2005, 11:08:50 AM3/30/05
to
Yukihiro Matsumoto wrote:
> PCRE does only support UTF-8 (as far as I know), not multiple
> encodings like Ruby does. Oniguruma supports UTF-8, UTF-16,
> ISO-8859-*, EUC-JP, Shift_JIS, and lot more.

Ah. I inferred as much from the prominence given the list of encodings,
but wanted to find out more.


Thanks,
--binkley


Yukihiro Matsumoto

unread,
Mar 30, 2005, 11:33:37 AM3/30/05
to

In message "Re: look-behind regexp ?"
on Thu, 31 Mar 2005 01:08:50 +0900, "B. K. Oxley (binkley)" <bin...@alumni.rice.edu> writes:

|Ah. I inferred as much from the prominence given the list of encodings,
|but wanted to find out more.

Here's the list of encodings supported by default:

ASCII BIG5 EUC-KR EUC-JP EUC-TW
ISO8859-1 ISO8859-2 ISO8859-3
ISO8859-4 ISO8859-5 ISO8859-6
ISO8859-7 ISO8859-8 ISO8859-9
ISO8859-10 ISO8859-11 ISO8859-13
ISO8859-14 ISO8859-15 ISO8859-16
KOI8 KOI8-R Shift_JIS UTF-8
UTF-16BE UTF-16LE UTF-32BE UTF-32LE

And more importantly, its encoding support is pluggable, you can add
new encoding support by writing callback routines.

matz.


Christian Neukirchen

unread,
Mar 31, 2005, 7:30:52 AM3/31/05
to
Yukihiro Matsumoto <ma...@ruby-lang.org> writes:

All this sounds very good. Is there any reason not to use Oniguruma
for 1.8.3?

> matz.
--
Christian Neukirchen <chneuk...@gmail.com> http://chneukirchen.org


Nikolai Weibull

unread,
Mar 31, 2005, 8:25:06 AM3/31/05
to
* Christian Neukirchen (Mar 31, 2005 14:45):

> Is there any reason not to use Oniguruma for 1.8.3?

It's still under very heavy development,
nikolai

--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: minimalistic.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}


George Ogata

unread,
Apr 2, 2005, 2:06:12 PM4/2/05
to
Florian Gross <fl...@ccan.de> writes:

> http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt seems to have a
> fairly complete listing of its features.

How about adding a metachar reference to the rdoc for Regexp? (Or
Regexp.new?)

0 new messages