def replace_tag(self, tag, value):
    if (value is None):
        value = ''
    pattern = re.compile((('\\$\\{([-_ ]*)' + tag) + '([-_ ]*)\\}'))
    result = re.findall(pattern, self.text)
    if (len(result) == 0):
        value = ''
    else:
        prepend = result[0][0]
        append = result[0][1]
    pattern = re.compile((('(\\$\\{[-_ ]*' + tag) + '[-_ ]*\\})'))
    result = re.findall(pattern, self.text)
    if (len(result) == 0):
        return
    if (value == ''):
        self.processed = self.processed.replace(result[0], '')
    else:
        self.processed = self.processed.replace(result[0], ((prepend + value) + append))
def replace_tag(self, tag, value):
    if (value is None):
        value = 
    pattern = re.compile((('\\$\\{([-_ ]*)' + tag) + '([-_ ]*)\\}'))
    result = re.findall(pattern, self.text)
    if (len(result) == 0):
        value = 
    else:
        prepend = result[0][0]
        append = result[0][1]
    pattern = re.compile((('(\\$\\{[-_ ]*' + tag) + '[-_ ]*\\})'))
    result = re.findall(pattern, self.text)
    if (len(result) == 0):
        return
    if (value == ):
        self.processed = self.processed.replace(result[0], )
    else:
        self.processed = self.processed.replace(result[0], ((prepend + value) + append))