class Regexp::Expression::Subexpression

def extract_quantifier_target(quantifier_description)

def extract_quantifier_target(quantifier_description)
  pre_quantifier_decorations = []
  target = expressions.reverse.find do |exp|
    if exp.decorative?
      exp.custom_to_s_handling = true
      pre_quantifier_decorations << exp.text
      next
    end
    exp
  end
  target or raise Regexp::Parser::ParserError,
    "No valid target found for '#{quantifier_description}' quantifier"
  target.pre_quantifier_decorations = pre_quantifier_decorations
  target
end