I get deep indentation when I write code like below
match = re.search(some_regex_1, s)
if match:
# do something with match data
else:
match = re.search(some_regex_2, s)
if match:
# do something with match data
else:
match = re.search(soem_regex_3, s)
if match:
# do something with match data
else:
# ...
# and so on
I tried to rewrite as:
if match = re.search(some_regex_1, s):
# ...
elif match = re.search(some_regex_2, s):
# ...
elif ....
# ...
...
but Python doesn't allow that syntax. What should I do to avoid deep indentation in this case?