I’m looking for a regular expression that would match 1 to n occurrences of numbers and only one occurrence of an arithmetic operator (only + or – are allowed)
For example, it should match -123 or 123- or +123 or 123+
This is what I have so far
import re
number = "-123"
if re.findall(r"[0-9]+[+|-]?", number):
return True
else:
return False
try something like this: