Basic Perl Metacharacters and Their Descriptions
|
|
|
matches an alarm (bell)
character.
|
|
matches a character
only at the beginning of a string.
|
|
matches a word boundary
(the position between a word and a space):
-
"er\b" matches the "er" in "never"
-
"er\b" does not match the "er"
in "verb"
|
|
matches a non-word boundary:
-
"er\B" matches the "er" in "verb"
-
"er\B" does not match the "er"
in "never"
|
|
matches a control character.
For example, \cX matches the control character control-X.
|
|
|
|
matches a digit character
that is equivalent to [0−9].
|
|
matches a non-digit
character that is equivalent to [^0−9].
|
|
matches an escape character.
|
|
specifies the end of
case modification.
|
|
matches a form feed
character.
|
|
specifies that the next
character is lowercase.
|
|
specifies that the next
string of characters, up to the \E metacharacter, is lowercase.
|
|
matches a newline character.
|
|
matches capture buffer num,
where num is a positive integer.
Perl variable syntax ($num) is valid when referring to capture buffers,
but not in other cases.
|
|
escapes (places a backslash
before) all non-word characters.
|
|
matches a return character.
|
|
matches any white space
character, including space, tab, form feed, and so on, and is equivalent
to [\f\n\r\t\v].
|
|
matches any character
that is not a white space character and is equivalent to [^\f\n\r\t\v].
|
|
|
|
specifies that the next
character is uppercase.
|
|
specifies that the next
string of characters, up to the \E metacharacter, is uppercase.
|
|
matches any word character
or alphanumeric character, including the underscore.
|
|
matches any non-word
character or non-alphanumeric character, and excludes the underscore.
|
|
matches the octal character ddd.
|
|
matches the hexadecimal
character dd.
|
|
matches a character
only at the end of a string.
|
|
matches a character
only at the end of a string or before newline at the end of a string.
|