.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OEParseSmarts

.. oe:function:: OEParseSmarts

   .. oe:language:: c++ java csharp

      .. oe:api::

         bool OEParseSmarts(OEQMolBase& mol, const char* smarts,
                            unsigned int opt = OESmartsParseOpts::Default)
         bool OEParseSmarts(OEQMolBase& mol, const char* smarts,
                            const OEVectorBindings& vbinding,
                            unsigned int opt = OESmartsParseOpts::Default)

   .. oe:language:: python

      .. oe:api:: python

         OEParseSmarts(arg1: OEQMol, arg2: str, opt: int) -> bool
         OEParseSmarts(arg1: OEQMol, arg2: str, vb: OEVectorBindings, opt: int) -> bool

   These functions generate a query molecule by parsing the given
   :term:`SMARTS` pattern.
   If the :term:`SMARTS` string passed to the function is valid and
   is parsed correctly the function will return ``true``,
   otherwise it will return ``false``.

   *mol*
    The :ref:`OEQMolBase <OEChem_OEQMolBase>` object that is generated for the
    given :term:`SMARTS` pattern.

   *smarts*
    The :term:`SMARTS` string that represents a molecular substructure query.

   *opts*
     The parameter determines how the :term:`SMARTS` pattern is interpreted.
     This value has to be from the :oe:constns:`OEChem::OESmartsParseOpts`
     namespace.

   *vbinding*
     The parameter provides a mechanism for parsing a :term:`SMARTS` pattern that
     contains vector bindings.  An :ref:`OEVectorBindings <OEChem_OEVectorBindings>` object
     containing the complete set of possible vector bindings that may be
     contained in a :term:`SMARTS` pattern, including recursive vector
     bindings, and passed to the :oe:func:`OEChem::OEParseSmarts` function.
     Vector bindings will be resolved while the :term:`SMARTS` pattern is being
     parsed.

   .. seealso::

      * :ref:`chapter_SMARTS` chapter
      * :oe:constns:`OEChem::OESmartsParseOpts` namespace
