

    \filetitle{dbsearchuserdata}{Search database to find tseries by matching the content of their userdata fields}{dbase/dbsearchuserdata}

	\paragraph{Syntax}
 
 \begin{verbatim}
 LIST = dbsearchuserdata(D,FIELD1,REGEXP1,FIELD2,REGEXP2,...)
 LIST = dbsearchuserdata(D,FLAG,FIELD1,REGEXP1,FIELD2,REGEXP2,...)
 \end{verbatim}
 \paragraph{Input arguments}
 
 \begin{itemize}
 \item
   \texttt{D} {[} struct {]} - Input database whose tseries fields will
   be searched.
 \item
   \texttt{FLAG} {[} '-all' \textbar{} '-any' {]} - Specifies if all
   conditions or any one condition must be met for the series to pass the
   test; if not specified, \texttt{'-all'} is assumed.
 \item
   \texttt{FIELD1}, \texttt{FIELD2}, \ldots{} {[} char {]} - Names of
   fields in the userdata struct.
 \item
   \texttt{REGEXP1}, \texttt{REGEXP2}, \ldots{} {[} char {]} - Regular
   expressions against which the respective userdata fields will be
   matched.
 \end{itemize}
 \paragraph{Output arguments}
 
 \begin{itemize}
 \item
   \texttt{LIST} {[} cellstr {]} - Names of tseries that pass the test.
 \item
   \texttt{D} {[} struct {]} - Output database with only those tseries
   that pass the test.
 \end{itemize}
 \paragraph{Description}
 
 For a successful match, the userdata must be a struct, and the tested
 fields must be text strings.
 
 Use an equal sign, \texttt{=}, after the name of the userdata fields in
 \texttt{FIELD1}, \texttt{FIELD2}, etc. to request a case-insensitive
 match, and an equal-shart sign, \texttt{=\#}, to indiciate a
 case-sensitive match.
 
 \paragraph{Example}
 
 \begin{verbatim}
 [list,dd] = dbsearchuserdata(d,'.DESC=','Exchange rate','.SOURCE=#','IMF');
 \end{verbatim}
 Each individual tseries object in the database \texttt{D} will be tested
 for two conditions:
 
 \begin{itemize}
 \item
   whether its user data is a struct including a field named
   \texttt{DESC}, and the field contains a string
   \texttt{'Exchange rate'} in it (case insensitive, e.g.
   \texttt{'eXcHaNgE rAtE'} will also be matched);
 \item
   whether its user data is a struct including a field named
   \texttt{SOURCE}, and the field contains a string \texttt{'IMF'} in it
   (case sensitive, e.g. \texttt{'Imf'} will not be matched).
 \end{itemize}
 All tseries object that pass both of these conditions are returned in
 the \texttt{LIST} and the output database \texttt{D}.


