Avoid utils.starts_with() from checking the entire haystack with lastIndexOf()