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? TIA, BC