The formal syntax, as specified using
`BNF <https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form>`_ notation with
the regular extensions, for registry query is the following:

.. parsed-literal::

  registry_query  ::= '[' `sep_definition`_? `root_key`_
                      ((`key_separator`_ `sub_key`_)? (`value_separator`_ `value_name`_)?)? ']'
  _`sep_definition`  ::= '{' `value_separator`_ '}'
  _`root_key`        ::= 'HKLM' | 'HKEY_LOCAL_MACHINE' | 'HKCU' | 'HKEY_CURRENT_USER' |
                      'HKCR' | 'HKEY_CLASSES_ROOT' | 'HKCC' | 'HKEY_CURRENT_CONFIG' |
                      'HKU' | 'HKEY_USERS'
  _`sub_key`         ::= `element`_ (`key_separator`_ `element`_)*
  _`key_separator`   ::= '/' | '\\'
  _`value_separator` ::= `element`_ | ';'
  _`value_name`      ::= `element`_ | '(default)'
  _`element`         ::= `character`_\+
  _`character`       ::= <any character except `key_separator`_ and `value_separator`_>

The `sep_definition`_ optional item offers the possibility to specify the
string used to separate the `sub_key`_ from the `value_name`_ item. If
not specified, the character ``;`` is used.

.. parsed-literal::

  # example using default separator
  |FIND_XXX| (... **PATHS** "/root/[HKLM/Stuff;InstallDir]/lib[HKLM\\\\Stuff;Architecture]")

  # example using different specified separators
  |FIND_XXX| (... **HINTS** "/root/[{|}HKCU/Stuff|InstallDir]/lib[{@@}HKCU\\\\Stuff@@Architecture]")

If the `value_name`_ item is not specified or has the special name
``(default)``, the content of the default value, if any, will be returned. The
supported types for the `value_name`_ are:

* ``REG_SZ``.
* ``REG_EXPAND_SZ``. The returned data is expanded.
* ``REG_DWORD``.
* ``REG_QWORD``.

When the registry query failed, typically because the key does not exist or
the data type is not supported, the string ``/REGISTRY-NOTFOUND`` is substituted
to the ``[]`` query expression.
