---
name: "re"
section: "3pm"
platform: "linux"
package: "perl-5.004-doc"
version: "5.004.05-6"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/re/3pm"
---

# re(3pm)

Perl pragma to alter regular expression behaviour

## NAME

re - Perl pragma to alter regular expression behaviour

## SYNOPSIS

```
    ($x) = ($^X =~ /^(.*)$/s);     # $x is not tainted here
```

```
    use re "taint";
    ($x) = ($^X =~ /^(.*)$/s);     # $x _is_ tainted here
```

(We use $^X in these examples because it's tainted by default.)

## DESCRIPTION

When `use re 'taint'` is in effect, and a tainted string is the target of a regex, the regex memories (or values returned by the m// operator in list context) are tainted.

This feature is useful when regex operations on tainted data aren't meant to extract safe substrings, but to perform other transformations.

See the section on *Pragmatic Modules* in the *perlmodlib* manpage.
