more efficient regex check