regex: question mark followed by colon as an alternative
cucumber, regex, ruby
Solution
This isn't a special group, it just means "match nothing or `I`": http://www.rubular.com/r/H3iJFLXaab
This should be the same as writing `(?:I )?` (or to be more precise, `(?:I )??` - because the empty string has precedence over `I`, see also Is the lazy version of the 'optional' quantifier ('??') ever useful in a regular expression? )
Problem
In rails cucumber there is this regex `When /^(?:|I )go to (.+)$/ do |page_name|` I know `?:` is a non-capturing group but what does it mean when it is there as an alternative separated by `|` ?