On 7/17/09, BrendanC <brencam / gmail.com> wrote: > I have the following text in a file: > > 1 a1.html > 2 b.doc > 3 c.xml > 4 d.tiff > 5 e.jpeg > 6 f.html > .... > > I need a regexp to match lines except those that end with ending in > ".html" - iow - I want lines 2-5 above. I believe this may require a > negative lookbehind match. I tried the following but Ruby (1.8) gives > an undefined sequence error : > > $(?<!\.html) # <---- this seems to work with other engines > > Before you jump re Ruby the version I also tested this here - > http://www.rubyxp.com/ and get invalid expression (fyi this tests with > Ruby 1.9). Any ideas/alternatives? Xavier and David gave good advice. If however you really have to have a matching regex %r($(?<!\.html)\z) # is that what you meant above? works fine. I believe that you can install Oniguruma on 1.8 as a gem for that purpose. HTH Robert -- Toutes les grandes personnes ont dÃÂbord ñÕdes enfants, mais peu dÃÆntre elles sÃÆn souviennent. All adults have been children first, but not many remember. [Antoine de Saint-ExupñÓy]