Difference between revisions of "Metacharacter"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Created page with "In computing, a '''metacharacter''' is a character that has a special meaning (instead of a literal meaning) to a computer program, such as a...")
 
 
Line 1: Line 1:
In [[computing]], a '''metacharacter''' is a [[Character (computing)|character]] that has a special meaning (instead of a literal meaning) to a [[computer program]], such as a shell interpreter or a regular expression engine.
+
In [[computing]], a '''metacharacter''' is a [[Character (computing)|character]] that has a special meaning (instead of a literal meaning) to a [[computer program]], such as a [[Shell (computing)|shell interpreter]] or a [[regular expression]] engine.
  
 
== Description ==
 
== Description ==
Line 11: Line 11:
 
* [[Delimiter]]
 
* [[Delimiter]]
 
* [[Markup language]]
 
* [[Markup language]]
 +
* [[Regular expression]]
 +
* [[Shell (computing)]]
  
 
== External links ==
 
== External links ==
Line 17: Line 19:
  
 
[[Category:Computer science]]
 
[[Category:Computer science]]
 +
[[Category:Computing]]

Latest revision as of 16:10, 26 August 2016

In computing, a metacharacter is a character that has a special meaning (instead of a literal meaning) to a computer program, such as a shell interpreter or a regular expression engine.

Description

In POSIX extended regular expressions, there are 14 metacharacters that must be preceded by a backslash "\" in order to drop their special meaning and be treated literally inside an expression: the open/close square brackets, "[" and "]"; the backslash "\"; the caret "^"; the dollar sign "$"; the period or dot "."; the vertical bar or pipe symbol "|"; the question mark "?"; the asterisk "*"; the plus-sign "+"; open/close curly braces, "{" and "}"; and open/close parenthesis, "(" and ")".

If you want to use any of these characters as a literal in a regex, you need to escape them with a backslash. For example, to match the arithmetic expression "(1+1)*3=6" with a regex, then the correct regex is "\(1\+1\)\*3=6". Otherwise, the parenthesis, plus-sign, and asterisk will have a special meaning.

See also

External links