#~ two digits, #~ followed by a dash, #~ followed by an optional digit, #~ followed by four digits use Regexp::English; my $re = Regexp::English -> new -> digit -> digit -> literal('-') -> optional -> digit -> end -> digit -> digit -> digit -> digit; print $re; __END__ (?^:\d\d\-(?:\d?)\d\d\d\d) #### \d Match a digit \d Match a digit \- Match a literal '-' character (?: The start of a non-capturing group \d? Match a digit, one-or-zero times (as many as possible) ) The end of non-capturing group \d Match a digit \d Match a digit \d Match a digit \d Match a digit