class_docstr: Utility class to manage a set of ``ConfigItem`` and resolve the references between them.
  
  This class maintains a set of ``ConfigItem`` objects and their associated IDs.
  The IDs must be unique within this set. A string in ``ConfigItem``
  starting with ``@`` will be treated as a reference to other ``ConfigItem`` objects by ID.
  Since ``ConfigItem`` may have a nested dictionary or list structure,
  the reference string may also contain the separator ``::`` to refer to a substructure by
  key indexing for a dictionary or integer indexing for a list.
  
  In this class, resolving references is essentially substitution of the reference strings with the
  corresponding python objects. A typical workflow of resolving references is as follows:
  
      - Add multiple ``ConfigItem`` objects to the ``ReferenceResolver`` by ``add_item()``.
      - Call ``get_resolved_content()`` to automatically resolve the references. This is done (recursively) by:
          - Convert the items to objects, for those do not have references to other items.
              - If it is instantiable, instantiate it and cache the class instance in ``resolved_content``.
              - If it is an expression, evaluate it and save the value in ``resolved_content``.
          - Substitute the reference strings with the corresponding objects.
  
  Args:
      items: ``ConfigItem``s to resolve, this could be added later with ``add_item()``.
docstr: Match regular expression for the input string to update content with the references.
  The reference part starts with ``"@"``, like: ``"@XXX::YYY::ZZZ"``.
  References dictionary must contain the referring IDs as keys.
  
  Args:
      value: input value to match regular expression.
      refs: all the referring components with ids as keys, default to `None`.
docstr_tok: ["Match","regular","expression","for","the","input","string","to","update","content","with","the","references",".","The","reference","part","starts","with","``","``","@","''","``",",","like",":","``","``","@","XXX",":",":YYY",":",":ZZZ","''","``",".","References","dictionary","must","contain","the","referring","IDs","as","keys",".","Args",":","value",":","input","value","to","match","regular","expression",".","refs",":","all","the","referring","components","with","ids","as","keys",",","default","to","`","None","`","."]
code: def update_refs_pattern(cls, value: str, refs: dict) -> str:
      """
      Match regular expression for the input string to update content with the references.
      The reference part starts with ``"@"``, like: ``"@XXX::YYY::ZZZ"``.
      References dictionary must contain the referring IDs as keys.
  
      Args:
          value: input value to match regular expression.
          refs: all the referring components with ids as keys, default to `None`.
  
      """
      # regular expression pattern to match "@XXX" or "@XXX::YYY"
      value = cls.normalize_id(value)
      result = cls.id_matcher.findall(value)
      # reversely sort the matched references by length
      # and handle the longer first in case a reference item is substring of another longer item
      result.sort(key=len, reverse=True)
      value_is_expr = ConfigExpression.is_expression(value)
      for item in result:
          # only update reference when string starts with "$" or the whole content is "@XXX"
          if value_is_expr or value == item:
              ref_id = item[len(cls.ref) :]  # remove the ref prefix "@"
              if ref_id not in refs:
                  msg = f"can not find expected ID '{ref_id}' in the references."
                  if not cls.allow_missing_reference:
                      raise KeyError(msg)
                  warnings.warn(msg)
                  continue
              if value_is_expr:
                  # replace with local code, `{"__local_refs": self.resolved_content}` will be added to
                  # the `globals` argument of python `eval` in the `evaluate`
                  value = value.replace(
                      item, f"{cls._vars}['{ref_id}']"
                  )
              elif value == item:
                  # the whole content is "@XXX", it will avoid the case that regular string contains "@"
                  value = refs[ref_id]
      return value
  
imports: from __future__ import annotations
  import re
  import warnings
  from collections.abc import Sequence
  from typing import Any, Iterator
  from monai.bundle.config_item import ConfigComponent, ConfigExpression, ConfigItem
  from monai.bundle.utils import ID_REF_KEY, ID_SEP_KEY
  from monai.utils import allow_missing_reference, look_up_option
label_desc: Use image node_id 12 for calling the ReferenceResolver obj's underlying member method code with example usage: obj.update_refs_pattern(cls, value, refs) and returns: value