I couldn't seem to find a thread on this one, but it seems like something that should be pretty simple. I'm trying to use regex to search a line in an output for a number 0-99, and do one action, but if the number is 100 then it'll do a different action. Here's what I have tried(simplified version):
OUTPUT = #Some command that will store the output in variable OUTPUT
OUTPUT = OUTPUT.split('\n')
for line in OUTPUT:
if (re.search(r"Rebuild status: percentage_complete", line)): #searches for the line, regardless of number
if (re.search("\d[0-99]", line)): #if any number between 0 and 99 is found
print("error")
if (re.search("100", line)): #if number 100 is found
print("complete")
I've tried this and it still picks up the 100 and prints error.