Package org.jbehave.core.parsers
Class RegexPrefixCapturingPatternParser
- java.lang.Object
-
- org.jbehave.core.parsers.RegexPrefixCapturingPatternParser
-
- All Implemented Interfaces:
StepPatternParser
public class RegexPrefixCapturingPatternParser extends Object implements StepPatternParser
A step pattern parser that provides a step matcher which will capture parameters starting with the given prefix in any matching step. Default prefix is $.
The parameter names are by default assumed to be any unicode-supported alphanumeric sequence, not limited to ASCII (see http://www.regular-expressions.info/unicode.html), i.e. corresponding to character class [\p{L}\p{N}\p{Pc}]. A different character class can optionally be provided.
- Author:
- Elizabeth Keogh, Mauro Talevi
-
-
Constructor Summary
Constructors Constructor Description RegexPrefixCapturingPatternParser()
Creates a parser which captures parameters starting with $ in a matching step and whose names are alphanumeric sequences.RegexPrefixCapturingPatternParser(String prefix)
Creates a parser which captures parameters starting with a given prefix in a matching step and whose names are alphanumeric sequencesRegexPrefixCapturingPatternParser(String prefix, String characterClass)
Creates a parser which captures parameters starting with a given prefix in a matching step and a given character class.
-
-
-
Constructor Detail
-
RegexPrefixCapturingPatternParser
public RegexPrefixCapturingPatternParser()
Creates a parser which captures parameters starting with $ in a matching step and whose names are alphanumeric sequences.
-
RegexPrefixCapturingPatternParser
public RegexPrefixCapturingPatternParser(String prefix)
Creates a parser which captures parameters starting with a given prefix in a matching step and whose names are alphanumeric sequences- Parameters:
prefix
- the prefix to use in capturing parameters
-
RegexPrefixCapturingPatternParser
public RegexPrefixCapturingPatternParser(String prefix, String characterClass)
Creates a parser which captures parameters starting with a given prefix in a matching step and a given character class.- Parameters:
prefix
- the prefix to use in capturing parameterscharacterClass
- the regex character class to find parameter names
-
-
Method Detail
-
getPrefix
public String getPrefix()
Description copied from interface:StepPatternParser
Returns current parameter prefix- Specified by:
getPrefix
in interfaceStepPatternParser
- Returns:
- parameter prefix, e.g. $
-
parseStep
public StepMatcher parseStep(StepType stepType, String stepPattern)
Description copied from interface:StepPatternParser
Parses a step pattern to create a step matcher- Specified by:
parseStep
in interfaceStepPatternParser
- Parameters:
stepType
- the step typestepPattern
- the step pattern- Returns:
- A StepMatcher that will capture the parameters associated with a step
-
-