Strings

Syntax

" *(CHAR) "

text: *( ' ' / TAB) (hash-comment)
*([CHAR-NOT-DOT *CHAR] CRLF / . 1*CHAR CRLF)

.

Description

Scripts involve large numbers of strings as they are used for pattern matching, addresses, textual bodies, etc. Typically, short quoted strings suffice for most uses, but a more convenient form is provided for longer strings such as bodies of messages.

A quoted string starts and ends with a single double quote (the " character, ASCII 34). A backslash (the \ character, ASCII 92) is used as escape character. Thus the two-character sequence \\ represents a single backslash or \" a doublequote within the string, respectively. Any other escape sequence (such as "\a" in a context where "a" has no special meaning) is interpreted as if there were no backslash (in this case, "\a" is just "a")

Non-printing characters such as tabs, CR, LF, NUL (ASCII 0) and control characters are permitted in quoted strings. Quoted strings may span multiple lines.

For entering larger amounts of text, such as an email message, a multi-line form is allowed. It starts with the keyword "text:", followed by a linebreak, and ends with the sequence of a linebreak, a single period, and another linebreak. In order to allow the message to contain lines with a single-dot, lines are dot-stuffed. That is, when composing a message body, an extra '.' is added before each line which begins with a '.'. When the server interprets the script, these extra dots are removed. Note that a line that begins with a dot followed by a non-dot character is not interpreted dot-stuffed; that is, ".foo" is interpreted as ".foo". However, because this is potentially ambiguous, scripts should be properly dot-stuffed so such lines do not appear.

Note that a hashed comment or whitespace may occur in between the "text:" and the linebreak (CRLF), but not with comments are not allowed here.

Example

"A Quoted String with \"quoted text\" and a backslash \\ to illustrate escaping." "Quoted text can span multiple lines" text: # You can add here a hash comment A multi-line String. No need to escape "quotes" and backslashes \ # Hash comments have no meaning But lines starting with a single "." need to be written as ".." .. is in stuffed and equivalent to . The string is ended by a single "." .

Module

Core : Requires no import statement

Resources

RFC3028