SocketTools .NET Edition

LlmClient.FindMessage Method (String, Int32)

Searches the conversation history for a message or response that matches the specified text.

[Visual Basic]
Overloads Public Function FindMessage( _
   ByVal pattern As String, _
   ByVal messageId As Integer _
) As Integer
[C#]
public int FindMessage(
   string pattern,
   int messageId
);

Parameters

pattern
A string which specifies the text that should be searched for. This may be a literal string or it may specify a simplified regular expression.
messageId
An integer which specifies the message ID that the search should begin with. If this value is zero, the search begins with the oldest message in the client history.

Return Value

If a matching message is found, the method returns the unique message identifier for the message. If no message prompts and/or responses match the search pattern, the method returns zero.

Remarks

The pattern you are matching against must be a null-terminated string and it cannot consist of only whitespace characters (spaces, tabs, carriage returns and linefeeds).

If a regular expression pattern is specified, the method compiles the pattern and searches the message content for a match. The regular expression matching uses a simplified version which only supports anchors, wildcards, match classes (enclosed in brackets) and a limited number of escape sequences such as \d to match any digit or \s to match any space character. It does not support grouping or replacement.

The GetMessage method can be used to obtain the contents of the prompt and/or response for a matching message.

See Also