Metacharacter

Updated: 04/26/2017 by Computer Hope

metacharacterA metacharacter is a character, or a sequence of characters, that has a special meaning in a computing application. It might be used to represent another set of characters, an unprintable character, or a logical operation. For example, in some applications, \n is interpreted as a newline. (In this case, a backslash is used to escape the n character, indicating that it should be interpreted as a metacharacter.)

Metacharacters are frequently used in regular expressions. For instance, the following Perl statement uses a regular expression to delete any newlines from the contents of the variable $data.

$data =~ s/\n//;

This statement says "assign a new value to $data which substitutes any newline in $data with nothing."

For a list of common metacharacters, and examples of how to use them, please see our Regular Expressions Quick Reference.

Character, Escape, Meta-data, Programming terms, Wildcard