method Edit.AddExpression (Start as String, Expression as String, End as String, [MultipleLines as Variant], [CaseSensitive as Variant])
Adds a single or multiple lines expression to a sensitive control.

TypeDescription
Start as String A string expression that defines the start of an expression.  The Start parameter is a combination of HTML tags. The HTML tags are used to paint the starting of an expression. The text in the expression is used to define the beginning of an expression.  The Start parameter should be a non empty string in order to define an expression. If the first character in the Start parameter is ^, it indicates that the expression should be at the beginning of the line, else it is ignored. For instance, the AddExpression("^<fgcolor=008000>*</fgcolor>", "<fgcolor=008000> </fgcolor>", ""), makes green the lines that starts with *. For instance, AddExpression("^", "<fgcolor=FF0000> ", ":" ), highlights the start of the line until : character is found. 
Expression as String A string expression that defines the HTML tags used to paint the expression. If the parameter is empty the Start HTML tags are used to paint the rest of the expression. The Expression parameter defines the HTML tags used to paint the expression. The text of the Expression is ignored.  
End as String A string expression that defines the end of an expression. The End parameter is a combination of HTML tags that defines the ending string of an expression, and the HTML tags used to paint the end of an expression.  If End parameter is Empty the expression ends to the end of line. 
MultipleLines as Variant Optional. A boolean expression that indicates whether the Start expression affects multiple lines or a single line. By default, the MultipleLines parameter is False.
CaseSensitive as Variant Optional. The CaseSensitive parameter is of  KeywordSensitiveEnum type. A long expression that indicates the type of the start and end expressions. The valid values are 0 - exCaseSensitiveKeyword, 1 - exNonCaseSensitiveKeyword and 2 - exReplaceKeyword. By default, the CaseSensitive parameter is 0 (exCaseSensitiveKeyword)

The AddExpression method adds a new expression to control's expressions collection. The method has effect if the control's EditType property is exSensitive. An expression begins with some text and may end with another text, or none. Use the AddKeyword method to add new keywords to the control. Use the IgnorePrefixInExpression property to define the prefixes being ignored by an expression. Use the MarkColor property to mark ( on the control's vertical scroll bar ) the positions of the expressions in the control's text. Use the FormatNumbers property to specify the format of the numbers in the control.

The list of supported built-in HTML tags is:

The AddExpression adds a new expression only if the text into the Start HTML expression is not empty. For instance if you define an expression like follows: "<b></b>" no expression will be added. Instead if you use "<fgcolor=008000><b>//</b></fgcolor>" it defines the "//" expression.  

Here's few samples how to define expressions and their explications:

The Start parameter of the AddExpression method defines the name of the expression that should be used in order to delete an expression. Use DeleteExpression method to delete an expression. For instance, if the Start parameter is "<b>START</b>" the name of the expression is "START" and "START" should be used for accessing the expression.  The name of the expression is the text of Start parameter after excluding the HTML tags. 

Call the Refresh method to reflect the changes in the control. The AddExpression, AddKeyword, DeleteExpressionDeleteKeyword, ClearKeywords and ClearExpressions do not reflect automatically the changes in the control's visible area until Refresh method is called. 

The following VB sample adds and a new expression to highlight the text between /* and */:

With Edit1
    .AddExpression "<b><fgcolor=008000>/*</fgcolor></b>", "<b><fgcolor=008000> </fgcolor></b>", "<b><fgcolor=008000>*/</fgcolor></b>", True
End With

The following C++ sample adds and a new expression to highlight the text between /* and */:

COleVariant vtMissing; vtMissing.vt = VT_ERROR;
m_edit.AddExpression("<b><fgcolor=008000>/*</fgcolor></b>", "<b><fgcolor=008000> </fgcolor></b>", "<b><fgcolor=008000>*/</fgcolor></b>", COleVariant( VARIANT_TRUE ), vtMissing );

The following VB.NET sample adds and a new expression to highlight the text between /* and */:

With AxEdit1
    .AddExpression("<b><fgcolor=008000>/*</fgcolor></b>", "<b><fgcolor=008000> </fgcolor></b>", "<b><fgcolor=008000>*/</fgcolor></b>", True, Nothing)
End With

The following C# sample adds and a new expression to highlight the text between /* and */:

axEdit1.AddExpression("<b><fgcolor=008000>/*</fgcolor></b>", "<b><fgcolor=008000> </fgcolor></b>", "<b><fgcolor=008000>*/</fgcolor></b>", true, null);

The following VFP sample adds and a new expression to highlight the text between /* and */:

With thisform.Edit1
    .AddExpression("<b><fgcolor=008000>/*</fgcolor></b>", "<b><fgcolor=008000> </fgcolor></b>", "<b><fgcolor=008000>*/</fgcolor></b>", .t.)
EndWith