Topic: Cucumber Step Definition Regex Help

I need some help with a regular expression in a Cucumber step definition file. Many of my steps are of the type:

Given I am on the search page

I use this general pattern for most of my step definitions, and use the default Webrat regex to pick it up that looks like this:

Given /^(?:|I )am on (.+)$/ do |page_name|
     visit path_to(page_name)

The problem is that I need to handle a page titled 'results' differently, and I do not know how to modify the above regex to exclude lines that say 'Given I am on the results page' Can someone help me modify my above regex to

Re: Cucumber Step Definition Regex Help

Is it only the results page or will it be used in more places. If it is only the results page why not try:

Given I am on the results page

with no quotes around results

and then you should get a step def of

Given /^I am on the results page$/ do 
    ....whatever you want to do

This should work for you if this is a unique step, but wont work if you want to treat many steps in a similar way

Re: Cucumber Step Definition Regex Help

That was actually one of the first things I tried, but I still get an error about both both regexs matching ambiguously. Hopefully there is some simple syntax to exclude the word 'result' from matching the "(.+)" regex.