Ambiguous match of "a volunteer ''Joe'' from ''Cincinnati''": features/step_definitions/user_steps.rb:1:in `/^a volunteer ''(.*)''$/'' features/step_definitions/user_steps.rb:5:in `/^a volunteer ''(.*)'' from ''(.*)''$/'' Don''t see how that''s ambiguous.
nevermind, I see it. On Sat, Feb 28, 2009 at 12:59 PM, Joe Van Dyk <joe at pinkpucker.net> wrote:> ? ? ?Ambiguous match of "a volunteer ''Joe'' from ''Cincinnati''": > > ? ? ?features/step_definitions/user_steps.rb:1:in `/^a volunteer ''(.*)''$/'' > ? ? ?features/step_definitions/user_steps.rb:5:in `/^a volunteer > ''(.*)'' from ''(.*)''$/'' > > > Don''t see how that''s ambiguous. >
Joe Van Dyk wrote:> Ambiguous match of "a volunteer ''Joe'' from ''Cincinnati''": > > features/step_definitions/user_steps.rb:1:in `/^a volunteer ''(.*)''$/'' > features/step_definitions/user_steps.rb:5:in `/^a volunteer > ''(.*)'' from ''(.*)''$/'' > > > Don''t see how that''s ambiguous. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >Try making your captures non-greedy (with ?). -Ben
On Sat, Feb 28, 2009 at 5:54 PM, Ben Mabey <ben at benmabey.com> wrote:> Joe Van Dyk wrote: >> ? ? ?Ambiguous match of "a volunteer ''Joe'' from ''Cincinnati''": >> >> ? ? ?features/step_definitions/user_steps.rb:1:in `/^a volunteer ''(.*)''$/'' >> ? ? ?features/step_definitions/user_steps.rb:5:in `/^a volunteer >> ''(.*)'' from ''(.*)''$/'' > > Try making your captures non-greedy (with ?).Greedy or non-greedy, both regexps still match. To distinguish between them, you (basically) need to replace ''.*'' with ''[^'']*'' . ///ark