Changing to the regex does seem like a simplification, although I don't know if that's a good enough reason to make this change as it introduces new dependencies.