0

I have a statement

Scenario Outline
@Given I have a coupon for "<campaign_name>"

Examples:
|Hotel|
|Movie|
|Shopping|

For this statement I have regex as:

@Given("^I have a coupon for \\\"([^\\\\\\\"]*)\\\"$")

I want to test this statement on popular online regex tool https://regexr.com/ Where it is failing, how come it is passing in Cucumber? enter image description here

Also, if I do reverse i.e. a regex passing in tool, then it fails in Cucumber. enter image description here

If I use

@Given("^I have a coupon for [^]*$") it will fail.

I want to write good, optimum, readable, short regex, for that I am dependent on tool. Please check, what am I doing wrong?

Update: using quotes not skipping them
It also give error enter image description here

paul
  • 4,333
  • 16
  • 71
  • 144

0 Answers0