I have tried
if re.match('.*[a-zA-Z].*' ,funcion) and not re.match("[x]", funcion):
It actually works, but I want to make my code smaller and I guess there is an option for reducing it. Like re.match('.*[a-zA-Z]^x.*' ,funcion), but it doesnt really work.
UPDATE:
I just made this:
if re.match('.*[a-zA-Z].*' ,funcion) and not re.match("x", funcion) and not re.match("[1-9]", funcion):
This works well, because I want to put functions like 7x + 3, and doing the upper thing wont work with 7x because it detects it. There should be a way to make this a pattern..
FULL CODE OF MY PROGRAM
while True:
  
  
   funcion = input("")
   if re.match('.*[a-zA-Z].*' ,funcion) and not re.match("x", funcion) and not re.match("[1-9]", funcion):
    print("Incorrecto, contiene una letra")
    
  
   elif "x" not in funcion:
      print("No contiene la X necesaria en una funcion.")
   else:
    break
"
 
    