Parse re N SMS options

Address extraction SMS options:  (regular expression)
 For mobile origination of e-mail, the gateway profile needs to extract a destination e-mail address from the text of the SMS message. This is done by means of one or more POSIX-compliant regular expressions (REs). The text of the SMS message will be evaluated by each regular expression until either a match producing a destination e-mail address is found or the list of regular expressions exhausted.

''' Note: Use of the  and   options are mutually exclusive. Use of both in the same gateway profile is a configuration error. '''

Each regular expression must be POSIX compliant and encoded in the UTF-8 character set. The regular expressions must output as string 0 the destination address. They may optionally output text to use in a Subject: header line as string 1, and text to use in the message body as string 2. Any text not "consumed" by the regular expression will also be used in the message body, following any text output as string 2.

The regular expressions will be tried in the order,  , ..., up to. If no regular expressions are specified and the option   has the value 0, then the following default regular expression is used, &#x5b; \t&#x5d;&#x2a;(&#x5b;^\( &#x5d;&#x2a;)&#x5b; \t&#x5d;&#x2a;(?:\((&#x5b;^\)&#x5d;&#x2a;)\))?&#x5b; \t&#x5d;&#x2a;(.&#x2a;) This default regular expression breaks into the following components: &#x5b; \t&#x5d;&#x2a; Ignore leading white space characters (SPACE and TAB). (&#x5b;^\( &#x5d;&#x2a;) Destination e-mail address. This is the first reported string. &#x5b; \t&#x5d;&#x2a; Ignore white space characters.  (?:\((&#x5b;^\)&#x5d;&#x2a;)\))? Optional subject text enclosed in parentheses. This is the second reported string. The leading  causes the outer parentheses to not report a string. They are being used merely for grouping their contents together into a single RE for the trailing ?. The trailing ? causes this RE component to match only zero or one time and is equivalent to the expression. &#x5b; \t&#x5d;&#x2a; Ignore white space characters. (.&#x2a;) Remaining text to message body. This is the third reported string.

For example, with the above regular expression, the sample SMS message: dan@sesta.com(Testing)This is a test yields the e-mail message: To: dan@sesta.com Subject: Testing This is a test As a second example, the SMS message: sue@sesta.com This is another test would yield: To: sue@sesta.com This is another test Note that the SMS message, prior to evaluation with these regular expressions, will be translated to the UTF-16 encoding of Unicode. The translated text is then evaluated with the regular expressions which were previously converted from UTF-8 to UTF-16. The results of the evaluation are then translated to US-ASCII for the destination e-mail address,    for the Subject: text, if any, and    for the message body, if any.

When the option   has the value 1,  then the default value for   is instead, &#x5b; \t&#x5d;&#x2a;(&#x5b;^\( &#x5d;&#x2a;)&#x5b; \t&#x5d;&#x2a;(.&#x2a;) With this default, the ability to split the SMS text between the resulting e-mail message&#x27;s Subject: header line and body is no longer present. The entire SMS message is placed in the Subject: header line.  This regular expression only describes how to distinguish the recipient&#x27;s e-mail address from the remainder of the SMS message.

See also:
 * route_to Option
 * text_to_subject Option
 * email_header_charset Option
 * email_body_charset Option
 * SMS gateway_profile options