I have these two tests. They pretty much do the same thing, so I don’t want to write two separate steps that do pretty much the same thing.
Scenario: I delete a question link
Given I am on the home page
When I "delete" a "question" link
Then A "question" link should be "deleted"
Scenario: I delete a account link
Given I am on the home page
When I "delete" an "account" link
Then An "account" link should be "deleted"
If I wanted to write a step that works with I "delete" a "question" link and I "delete" an "account" link, how would I modify the following regex to handle “a” and “an”.
/^I "([^"]*)" a/an?? "([^"]*)" link$/
This should do:
The question mark denotes that the “n” character can be part of the string but doesn’t have to
If there’s any “value” in the type you could also use: