[rspec-users] regex help

Stephen Eley sfeley at gmail.com
Mon Dec 29 01:07:51 EST 2008

On Sun, Dec 28, 2008 at 11:59 PM, Jonathan Linowes
<jonathan at parkerhill.com> wrote:
> Perhaps tell it to ignore any matches with " item" in it, but dont know how

It's called a zero-width negative lookahead, and it looks like this:
/^the (?!\w+ item)(.*) should have a \<(.*)\> tag with "(.*)"/

I didn't test this to be sure, but I believe it should work.  But
rephrasing your steps so that one isn't a special case of the other
would probably be better.  Or just having one step that contains the
logic from both.

Have Fun,
   Steve Eley (sfeley at gmail.com)
   ESCAPE POD - The Science Fiction Podcast Magazine

More information about the rspec-users mailing list