input: Write a function to evaluate a polynomial expression in the form of 'ax^b + cx^d + ...' and calculate the result for a specific x value.
  assert evaluate_polynomial("2x^2 + 3x^1", 2) == 14
  assert evaluate_polynomial("5x^3 + 2x^2 - 4x^1 + 1", 1) == 4
  assert evaluate_polynomial("3x^4 - x^3 + 2x^2 - 5x^1 + 7", 0) == 7
output: def evaluate_polynomial(expression, x):
      import re
      terms = re.findall(r'[+-]?\s*\d*x\^\d+|[+-]?\s*\d*x|[+-]?\s*\d+', expression.replace(' ', ''))
      result = 0
      for term in terms:
          if 'x^' in term:
              coeff, power = term.split('x^')
              coeff = int(coeff) if coeff not in ('+', '-') else int(coeff + '1')
              power = int(power)
          elif 'x' in term:
              coeff = term.replace('x', '')
              coeff = int(coeff) if coeff else 1
              power = 1
          else:
              coeff = int(term)
              power = 0
          result += coeff * (x ** power)
      return result