Looks like what I want is a DoNothingPatternBuilder :)

Something that is implemented like:
public Pattern buildPattern(String matchThis) {
  return Pattern.compile(matchThis, Pattern.DOTALL);
}

The problem will be in implementing extractGroupNames. What are group
names used for?
Could I simply return the group number?

Maybe this breaks example tables.

- Hitesh [http://hitesh.in/]



2009/10/29 Hitesh Sarda <[email protected]>:
> The current use case is allow a bit more relaxed / flexible syntax.
>
> So I want to map all of these step definitions to a single step.
>
> When the item price is 25
> When the item price = 25
> When the item price equals 25$
> When the item price is equal to 25
>
> So I could write a When annotation something like:
> @When("the item price.+[0-9\.]+$*")
>
> Haven't tested the regex above, but hope you get the idea.
>
> Will look at the PrefixCapturingPatternBuilder and try to find a
> solution. Any pointers are welcome.
>
> - Hitesh
>
>
>
> 2009/10/29 Mauro Talevi <[email protected]>:
>> Hitesh,
>>
>> granted that you can as Liz rightfully notes the possibility to provide your
>> own PatternBuilder, may I ask what your use case is?
>>
>> Would you be able just detail briefly what you perceive as a limitation?
>>
>> Cheers
>>
>> Elizabeth Keogh wrote:
>>>
>>> Hi Hitesh,
>>>
>>> The Steps class has an extra constructor that takes a
>>> StepsConfiguration. Inside that is the PrefixCapturingPatternBuilder,
>>> which is responsible for matching steps to patterns. If you wanted to
>>> do something differently to the $token method that we're using, you
>>> could replace this to allow matches to happen in any way you prefer.
>>>
>>> It doesn't support this out of the box.
>>>
>>> Cheers,
>>> Liz.
>>>
>>> On Wed, Oct 28, 2009 at 8:40 PM, Hitesh Sarda <[email protected]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> First, let me thank you for the excellent work. I am dipping my toes
>>>> into jbehave and liking it so far.
>>>>
>>>> I am wondering if jbehave supports regex matching in step definition.
>>>>
>>>> cucumber allows a step like below, which gives great flexibility.
>>>>
>>>>  Given /^I have opened "([^\"]*)"$/
>>>>
>>>> Is something similar possible in jbehave?
>>>>
>>>> Thanks
>>>> Hitesh
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>   http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to