On Fri, Sep 15, 2000 at 02:20:00AM -0400, Jeff Pinyan wrote: > In this simple example, we're matching the LAST occurrence of 'aaaa' in a > string. In the standard approach, we'd use something like: > > /aaaa(?!.*aaaa)/ 'aaaaaaaa' =~ /aaaa(?!.*aaaa)/ ^^^^ The substring that is matched is substr('aaaaaaa', 1, 4), not substr('aaaaaaa', 4, 4), because (?!.*aaaa) allows for a substring of three 'a's. So, if the string ends with more than four 'a's, this regex does not give the desired results. > This could be optimized to > > /aaaa(?:[^a]+a{1,3})*$/ That one does give the desired results. Ronald ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe