adding try catch when using isRegular()