import re


def update_version(lines, version):
    """ Update the text of a conda recipe to a given version. """
    quoted_version = '"' + version + '"'
    set_version_pattern = '(?<=set version = ).*(?= %})'
    lines = [re.sub(set_version_pattern, quoted_version, l) for l in lines]
    return lines