Port of isNumberMatch method