I want to match a valid "subtraction" equation of an unknown number (non-zero) of 'z' characters.
Valid string examples: "zzz-z=zz" or "zzzz-zzz=z"
Invalid string examples: "z-zz=z" or "zzz-z=z" or "z-zz=-z"
I have tried something like this, but it doesn't work. I believe it has to do with some sort of back-referencing?
re.match(r'(z+)\-(z+)\=(?!\2)\1', s)
Any help would be greatly appreciated.