# classname_indexname_pattern_search

> This function initiates the pattern search and, if successful, returns the handle in the obj parameter of the first object that matches the pattern.

### Prototype

>         MCO_RET	classname_indexname_pattern_search(	/*IN*/ mco_trans_h trans,
>                                    /*IN*/ void *buf,
>                                    /*IN*/ uint4 bsize,
>                                    /*OUT*/ classname *obj,
>                                    /*IN*/ [<type> key1 | const <type> *key1],
>                                    [/*IN*/ uint2 sizeof_key1, ],
>                                    [/*IN*/[<type> key2 | const <type> *key2],
>                                    /*IN*/ uint2 sizeof_key2, …],
>                                    /*OUT*/ uint4 *pattern_size);

### Arguments

trans | A transaction handle returned by `mco_trans_start()`
buf | The buffer of the size indicated by`classname_indexname_pattern_size()`
bsize | The size of buf, as indicated by `classname_indexname_pattern_size()`
obj | The object handle of the first object that matches the given pattern(s).
key1 | The <type> of key1 corresponds to the type of the first field in the index indexname. If key1 is a char or string type, then key1 contains a wildcard (regular expression) pattern to be matched, for example, “foo*”
sizeof_key1 | If key1 is a char or string, this argument is present and is the string length of key1. For non-char/string types, this parameter is not present
key2 | The <type> of key2 corresponds to the type of the second field in the index indexname. If key2 is a char or string type, then key2 contains a wildcard (regular expression) pattern to be matched, for example, “bar*”
sizeof_key2 | If key2 is a char or string, this argument is present and is the string length of key2. For non-char/string types, this parameter is not present.
… | Each additional element of indexname is represented by an argument.
key1 | The <type> of key1 corresponds to the type of the first field in the index indexname. If key1 is a char or string type, then key1 contains a wildcard (regular expression) pattern to be matched, for example, “foo*”

### Description

> This function initiates the pattern search and, if successful, returns the handle in the obj parameter of the first object that matches the pattern.

### Return Codes

MCO_S_OK | The cursor was positioned successfully
MCO_S_NOTFOUND | The search values did not match any object of the class

Related Topics