I cannot seem to figure out how to write a regex to match on if all match in python:
- {'ERROR_CODE': 500}
- {'ERROR_CODE': 404}
- {'ERROR_CODE': 501}
- {'ERROR_CODE': 409}
I need the regex to match {'ERROR_CODE': first, which can be followed be either 5XX OR 4XX, and ending with }
i am able to specify and get it to work, how to make it match on the entire range 400-499 or 500-599.
// python snippet
err_pattern = re.compile("{\'ERROR_CODE\': 500}|{\'ERROR_CODE\': 404}")
if all(err_pattern.match(str(values)) for values in self.set.values()):
output.append('All are 4XX and 5XX')
Any help would be highly appreciated.