On 9/7/08, Peñá, Botp <botp / delmonte-phil.com> wrote: > irb(main):036:0> re2 > => /galleries.*?([^t][^h][^u][^m][^b]).jpg/ > irb(main):038:0> g.select{|x| x=~re2 } > => ["galleries/image1.jpg", "galleries/image2.jpg", "galleries/image3.jpg"] Unfortunately this way will fail to match (for instance) "bomb.jpg". If you want to go this route, you need to do something like this: (untested!) /^galleries.*([^t]humb|[^h]umb|[^u]mb|[^m]b|[^b])\.jpg$/ #bleah Patrick He wrote: > /^galleries\/((?!thumb).)+\.jpg$/ Ah, brilliant! But it doesn't quite work. It fails to match "thumb_foo.jpg", which probably should match here. A simple modification should fix it, tho: /^galleries\/((?!thumb\.jpg$).)+\.jpg$/ There. That's a pretty nice pure regexp.