Added support for optional parts in regexps