7 re - Perl pragma to alter regular expression behaviour
12 ($x) = ($^X =~ /^(.*)$/s); # $x is tainted here
14 $pat = '(?{ $foo = 1 })';
16 /foo${pat}bar/; # won't fail (when not under -T switch)
19 no re 'taint'; # the default
20 ($x) = ($^X =~ /^(.*)$/s); # $x is not tainted here
22 no re 'eval'; # the default
23 /foo${pat}bar/; # disallowed (with or without -T switch)
27 /^(.*)$/s; # output debugging info
28 # during compile and run time
32 When C<use re 'taint'> is in effect, and a tainted string is the target
33 of a regex, the regex memories (or values returned by the m// operator
34 in list context) are tainted. This feature is useful when regex operations
35 on tainted data aren't meant to extract safe substrings, but to perform
36 other transformations.
38 When C<use re 'eval'> is in effect, a regex is allowed to contain
39 C<(?{ ... })> zero-width assertions even if regular expression contains
40 variable interpolation. That is normally disallowed, since it is a
41 potential security risk. Note that this pragma is ignored when the regular
42 expression is obtained from tainted data, i.e. evaluation is always
43 disallowed with tainted regular expresssions. See L<perlre/(?{ code })>.
45 For the purpose of this pragma, interpolation of preexisting regular
46 expressions is I<not> considered a variable interpolation, thus
50 I<is> allowed if $pat is a preexisting regular expressions, even
51 if $pat contains C<(?{ ... })> assertions.
53 When C<use re 'debug'> is in effect, perl emits debugging messages when
54 compiling and using regular expressions. The output is the same as that
55 obtained by running a C<-DDEBUGGING>-enabled perl interpreter with the
56 B<-Dr> switch. It may be quite voluminous depending on the complexity
58 See L<perldebug/"Debugging regular expressions"> for additional info.
60 I<The directive C<use re 'debug'> is not lexically scoped.> It has
61 both compile-time and run-time effects.
63 See L<perlmodlib/Pragmatic Modules>.
77 Carp::carp("Useless use of \"re\" pragma");
83 @ISA = ('DynaLoader');
87 uninstall() unless $on;
90 $bits |= $bitmask{$s} || 0;