import re


def changeStrokeOpacity(text, opacity):
    """
    Change all stroke opacities in a given string of text to the provided
    opacity. Returns the text with modifications made.
    """

    newData = None
    regularExpression = re.compile(r'stroke-opacity:[0-9]*[.]?[0-9]+[;|"]')
    matchOb = regularExpression.search(text)
    if matchOb is not None:
        newData = re.sub(r'stroke-opacity:[0-9]*[.]?[0-9]+',
                         r'stroke-opacity:' + opacity, text)
    else:
        newData = text

    return newData