Get rid of `re` module usages by using guards