[MacRuby-devel] regex error with negative look-ahead and look-behind

Alan Skipp al_skipp at fastmail.fm
Wed Dec 22 03:23:07 PST 2010


Hi Laurent,
I've filed a ticket. I'm not aware of any library that is affected by this currently. 
The regex I was using matches 4 digits that represent a year, but excludes things like '22010' and '20100', I've avoided the bug by using a positive-lookahead instead (?=\D).

Alan


On 22 Dec 2010, at 03:30, Laurent Sansonetti wrote:

> Hi Alan,
> 
> Thanks for the report. Please file a ticket: http://www.macruby.org/trac/newticket
> 
> Do you happen to know if a ruby library makes use of this? It can help us screen the priority of this bug.
> 
> Thanks :)
> Laurent
> 
> On Dec 21, 2010, at 2:01 PM, Alan Skipp wrote:
> 
>> When combining negative look-ahead with look-behind in a regexp, macruby doesn't match correctly. Here's an example.
>> 
>> ruby 1.9.2
>>>> m = "abc123abc".match /(?<=\w) (\d{3}) (?!\d)/x
>> => #<MatchData "123" 1:"123"> 
>>>> m.to_s
>> => "123" 
>> 
>> 
>> macruby (0.9)
>>>> m = "abc123abc".match /(?<=\w) (\d{3}) (?!\d)/x
>> => #<MatchData "" 1:"123">
>>>> m.to_s
>> => ""
>> 
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20101222/01a543a0/attachment-0001.html>


More information about the MacRuby-devel mailing list