# non-capturing groups are added when necessary

'hello'? | 'world'?
-----
(?:hello)??|(?:world)??