Regex

A Regex object represents a regular expression, which is fully Perl5 compatible.

/^my?\s*re(g|[ex])\z/i

Alternatively, one can write:

Regex('^my?\s*re(g|[ex])\z', 'i')