qr#

//

Synopsis#

my $re = qr/pattern/flags;
$str =~ $re;             # use in match
$str =~ /${re}suffix/;   # interpolate into pattern

Description#

Creates a precompiled regular expression object.

Compiles the pattern (from OpData::Pm or a runtime-interpolated string in runtime_regex_pattern) into a regex and wraps it as a blessed reference in the Regexp class. The stringified form is (?^flags:pattern), matching perl5 behaviour.

The returned object can be used directly in pattern matches, interpolated into other patterns, or stored in variables, arrays, and hashes for later use.

See also#

m//, s///, perlre, perlop