In Cucumber 2 a regular expression is expressed as (.*) to get a parameter for the glue code. The expressions documentation of Cucumber 3 says that "You can use Regular Expressions or Cucumber Expressions." but sadly it does not mention the syntax.
In Cucumber 3 and 4 () expresses optional text and is equivalent to (?:) in Cucumber 2.
When () is reserved for optional text how can I define a regex in Cucumber 3? As {.*}?
Cucumber 3 introduced Cucumber Expressions. For simple use cases they serve as a more readable regular expression. Unfortunately Java does not have a syntax to distinguish regular expressions from strings. So to distinguish between the two Cucumber JVM uses a heuristic.
strings are cucumber expressions by default^definitely a regexp$/surely a regexp/this (.+) like a regexpthis look(s) like a cukexpAdding ^ and end markers $ is the surest way to get the regular expression behavior.