class_docstr: A component to parse the output of a Generator to `Answer` objects using regular expressions.
code: def _check_num_groups_in_regex(pattern: str):
      num_groups = re.compile(pattern).groups
      if num_groups > 1:
          raise ValueError(
              f"Pattern '{pattern}' contains multiple capture groups. "
              f"Please specify a pattern with at most one capture group."
          )
  
file_path: haystack/haystack/components/builders/answer_builder.py
imports: import logging
  import re
  from typing import List, Dict, Any, Optional
  from haystack import component, GeneratedAnswer, Document
label_desc: Use image node_id 5 for calling the AnswerBuilder obj's underlying member method code with example usage: obj._check_num_groups_in_regex(pattern) without return types