Concept

Metacharacter

Résumé
A metacharacter is a character that has a special meaning to a computer program, such as a shell interpreter or a regular expression (regex) engine. In POSIX extended regular expressions, there are 14 metacharacters that must be escaped (preceded by a backslash ()) in order to drop their special meaning and be treated literally inside an expression: opening and closing square brackets ([ and ]); backslash (); caret (^); dollar sign ($); period/full stop/dot (.); vertical bar/pipe symbol (|); question mark (?); asterisk (*); plus and minus signs (+ and -); opening and closing curly brackets/braces ({ and }); and opening and closing parentheses (( and )). For example, to match the arithmetic expression (1+1)*3=6 with a regex, the correct regex is (1+1)*3=6; otherwise, the parentheses, plus sign, and asterisk will have special meanings. Some other characters may have special meaning in some environments. In some Unix shells the semicolon (";") is a statement separator. In XML and HTML, the ampersand ("&") introduces an HTML entity. It also has special meaning in MS-DOS/Windows Command Prompt. In some Unix shells and MS-DOS/Windows Command Prompt, the less-than sign and greater-than sign ("") are used for redirection and the backtick/grave accent ("`") is used for command substitution. In many programming languages, strings are delimited using quotes (" or '). In some cases, escape characters (and other methods) are used to avoid delimiter collision, e.g. "He said, "Hello"". In printf format strings, the percent sign ("%") is used to introduce format specifiers and must be escaped as "%%" to be interpreted literally. In SQL, the percent is used as a wildcard character. In SQL, the underscore ("_") is used to match any single character. Escape character The term "to escape a metacharacter" means to make the metacharacter ineffective (to strip it of its special meaning), causing it to have its literal meaning. For example, in PCRE, a dot (".") stands for any single character. The regular expression "A.
À propos de ce résultat
Cette page est générée automatiquement et peut contenir des informations qui ne sont pas correctes, complètes, à jour ou pertinentes par rapport à votre recherche. Il en va de même pour toutes les autres pages de ce site. Veillez à vérifier les informations auprès des sources officielles de l'EPFL.
Cours associés (1)
ENG-270: Computational methods and tools
This course prepares students to use modern computational methods and tools for solving problems in engineering and science.
Concepts associés (6)
String literal
A string literal or anonymous string is a literal for a string value in the source code of a computer program. Modern programming languages commonly use a quoted sequence of characters, formally "bracketed delimiters", as in x = "foo", where "foo" is a string literal with value foo. Methods such as escape sequences can be used to avoid the problem of delimiter collision (issues with brackets) and allow the delimiters to be embedded in a string. There are many alternate notations for specifying string literals especially in complicated cases.
Barre oblique inversée
La barre oblique inversée, tracée « \ », parfois appelée contre-oblique et connue également sous les appellations backslash ou antislash, est un symbole typographique. Elle se distingue de la barre oblique « / ». left|thumb|Barre et bande en héraldique. En héraldique, la bande est une bande oblique partant du coin supérieur gauche vers le coin inférieur droit, par opposition à la barre. Liste de pièces héraldiques#Bande Le symbole \ est parfois utilisé en lieu et place du symbole ∖ (U+2216) qui signifie « privé de ».
Séparateur (informatique)
A delimiter is a sequence of one or more characters for specifying the boundary between separate, independent regions in plain text, mathematical expressions or other data streams. An example of a delimiter is the comma character, which acts as a field delimiter in a sequence of comma-separated values. Another example of a delimiter is the time gap used to separate letters and words in the transmission of Morse code. In mathematics, delimiters are often used to specify the scope of an operation, and can occur both as isolated symbols (e.
Afficher plus