From: Robert Dober Date: 2009-07-17T17:54:34+09:00 Subject: Re: regexp exclusion search - find matches NOT ending with a string? On 7/17/09, BrendanC 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 : > > $(? > 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($(?