The backslash is a typographical mark used mainly in computing and mathematics. It is the mirror image of the common slash . It is sometimes called a hack, whack, Escape character (from C/UNIX), reverse slash, slosh, downwhack, backslant, backwhack, bash, reverse slant, and reversed virgule. Macquarie Dictionary (3rd edition) It is a relative recent mark, first documented in the 1930s.
In June 1960, IBM published an "Extended character set standard" that includes the symbol at 0x19. (unpublished paper submitted to IEEE, better source needed.) In September 1961, Bob Bemer (IBM) proposed to the X3.2 standards committee that , and be made part of the proposed standard, describing the backslash as a "reverse division operator" and cited its prior use by Teletype in telecommunications. In particular, he said, the was needed so that the ALGOL boolean operators (logical conjunction) and (logical disjunction) could be composed using and respectively. The Committee adopted these changes into the draft American Standard (subsequently called ASCII) at its November 1961 meeting.
The Teletype Model 33 (1963) appears to be the first commercially available unit that has the character as a standard keytop for sale in some markets; this model has a full ASCII character set.
Regular expression languages used it the same way, changing subsequent literal characters into and vice versa. For instance searches for either '|' or 'b', the first bar is escaped and searched for, the second is not escaped and acts as an "or".
Outside quoted strings, the only common use of backslash is to ignore ("escape") a newline immediately after it. In this context it may be called a "continued line" as the current line continues into the next one. Some software replaces the backslash+newline with a space.
To support computers that lacked the backslash character, the C trigraph was added, which is equivalent to a backslash. Since this can escape the next character, which may itself be a , the primary modern use may be for code obfuscation. Support for trigraphs was removed in C++17.
In APL is called Expand when used to insert fill elements into arrays, and Scan when used to produce prefix reduction (cumulative fold).
In Haskell, the backslash is used both to introduce special characters and to introduce lambda functions (since it is a reasonable approximation in ASCII of the Greek letter lambda, λ).O'Sullivan, Stewart, and Goerzen, Real World Haskell, ch. 4: anonymous (lambda) functions, p.99
The Microsoft Windows family of operating systems inherited the MS-DOS behavior and so still support either character – but individual Windows programs and sub-systems may, wrongly, only accept the backslash as a path delimiter, or may misinterpret a forward slash if it is used as such. Some programs will only accept forward slashes if the path is placed in Quotation mark. The failure of Microsoft's security features to recognize unexpected-direction slashes in local and Internet paths, while other parts of the operating system still act upon them, has led to some serious lapses in security. Resources that should not be available have been accessed with paths using particular mixes, such as .
The backslash is also sometimes used to denote the right coset space.
Especially when describing computer algorithms, it is common to define backslash so that is equivalent to . This is integer division that rounds down, not towards zero. In Wolfram Mathematica the backslash is used this way for integer divide.
Several other ISO 646 versions also replace backslash with other characters, including ₩ (Korean), Ö (German, Swedish), Ø (Danish, Norwegian), ç (French) and Ñ (Spanish), leading to similar problems, though with less lasting impact compared to the yen sign.
In 1991, RFC 1345 suggested as a unique two-character mnemonic that might be used in internet standards as "a practical way of identifying this character, without reference to a coded character set and its code in that coded character set". Consequently, this style may be seen in early Internet Engineering Task Force documents.