
Most times, the pattern is evaluated in double-quotish context, but it is possible to choose delimiters to force single-quotish, like $foo =~ m'abc' In most cases, the delimiter is the same character, fore and aft, but there are a few cases where a character looks like it has a mirror-image mate, where the opening version is the beginning delimiter, and the closing one is the ending delimiter, like $foo =~ m These are often, as in the example above, forward slashes, and the typical way a pattern is written in documentation is with those slashes. Patterns that aren't already stored in some variable must be delimited, at both ends, by delimiter characters. (The =~ m, or match operator, is described in "m/PATTERN/msixpodualngc" in perlop.) This evaluates to true if and only if the string in the variable $foo contains somewhere in it, the sequence of characters "a", "b", then "c". Usually the match is done by having the target be the first operand, and the pattern be the second operand, of one of the two binary operators =~ and !~, listed in "Binding Operators" in perlop and the pattern will have been converted from an ordinary string by one of the operators in "Regexp Quote-Like Operators" in perlop, like so: $foo =~ m/abc/ We call this "matching" the target string against the pattern. Patterns are used to determine if some other string, called the "target", has (or doesn't have) the characteristics specified by the pattern. Regular expressions are strings with the very particular syntax and meaning described in this document and auxiliary documents referred to by this one. It can find things that, while legal, may not be what you intended. New in v5.22, use re 'strict' applies stricter rules than otherwise when compiling regular expression patterns.
Grep perl regex plus#
For a reference on how they are used, plus various examples of the same, see discussions of m//, s///, qr// and "?" in "Regexp Quote-Like Operators" in perlop.

If you know just a little about them, a quick-start introduction is available in perlrequick.Įxcept for "The Basics" section, this page assumes you are familiar with regular expression basics, like what is a "pattern", what does it look like, and how it is basically used. If you haven't used regular expressions before, a tutorial introduction is available in perlretut. This page describes the syntax of regular expressions in Perl. Perlre - Perl regular expressions #DESCRIPTION Repeated Patterns Matching a Zero-length Substring.Character Classes and other Special Escapes.Character set modifier behavior prior to Perl 5.14.

Which character set modifier is in effect?.
