Metacharacters

from Wikipedia, the free encyclopedia

Metacharacters or function characters are characters in a file or character string that do not stand for themselves within a certain context, but, like control characters, have a special meaning for the processing of the data. The respective meaning of the metacharacters depends on the program with which the data is processed.

Often, non- alphanumeric characters are chosen as metacharacters. In order to be able to use metacharacters as pure characters in addition to their special meaning, rules for masking are often provided.

Occurrence

Markups

  • In XML , the following characters are metacharacters: <and &(at every position) as well as "or 'for attribute values.
  • When in Wikipedia used Wikitext example, has twice the square bracket , a term - in other words - the function of the term to another page within the Wikipedia link . The brackets are not displayed in the finished text, but are only noticeable when the relevant term is linked.[[Begriff]]

Programming languages

Within a programming language , metacharacters are the characters used for operators and separators . In C ajar and C programming languages such. B. C ++ , Java , PHP , Perl , Tcl , Python , Ruby , C # are z. B. mostly the characters ! " % & / ( ) = ? { [ ] } \ + * ~ < > | , ; . : - ^and 'defined as metacharacters.

Regular expressions

In a regular expression , metacharacters are characters that do not stand for themselves, but have a special meaning as an anchor, character class, quantifier, or something similar. In most regular expression implementations, the following characters are metacharacters:

  • ^ (Anchor for beginning [line or string])
  • $ (Anchor for end [line or string])
  • ? + * { } (Quantifiers or repetition factors)
  • \ (Changing the meta-status of a character [a meta-character loses its special meaning or a non-meta-character receives a special meaning])
  • . [ ] (Character classes)
  • & (Back reference)
  • ( ) (Grouping)
  • | alternative

Further

  • When importing a CSV file in a spreadsheet program has a character (usually ,, ;or the tab ), the function of a separator which separates individual elements, so that the table to be imported these elements in different cells. The character itself does not appear in the finished table.
  • With EDIFACT , the EDI program is informed (in the optional UNA segment) which characters have the function of data element separator, segment separator, masking character and element group separator for this file . For a text editor, however , these characters have no function.

See also