Replaced regex with Flask built-in helper