class Dependabot::Uv::FileUpdater::LockFileUpdater
def declaration_regex(dep, old_req)
def declaration_regex(dep, old_req) escaped_name = Regexp.escape(dep.name) # Extract the requirement operator and version operator = old_req.fetch(:requirement).match(/^(.+?)[0-9]/)&.captures&.first # Escape special regex characters in the operator escaped_operator = Regexp.escape(operator) if operator # Match various formats of dependency declarations: # 1. "dependency==1.0.0" (with quotes around the entire string) # 2. dependency==1.0.0 (without quotes) # The declaration should only include the package name, operator, and version # without the enclosing quotes / ["']?(?<declaration>#{escaped_name}\s*#{escaped_operator}[\d\.\*]+)["']? /x end