Notes for Regex

Example 1
$_ = "yabba dabba doo";

Modifier

/i Case Insensitive
/s Match any character including newline
/x Allow meaningless whitespace in regex for easy reading, if matching literal space is required, use "/ " or \t or \s

if matching pound sign is required, use
/# or [#]

Choose a Character Interpretation

/a for ASCII
/u for Unicode
/l for local

Anchors

m{\Ahttps?://}i
\A would match the exact beginning of a string, before Perl 4 it is ^

m{.png\z}i
\z would match the absolute end of a string, before Perl 4 it is $

m{.png\Z}i
\Z would allow newlines after.

m{\bfred\b}i
\b matches at either end of a word*. Word must only contain \w.

[0-9] \d
[A-Za-z0-9_] \w
[\f\t\n\r] \s
[\t ] \h
[\f\n\r] \v

\R 任何方式断行* (跨系统)
大写表示反义简写

你可能感兴趣的:(Notes for Regex)