I have copied it from my code, please feel free to change it as required. let usZipPattern = new RegExp("^\\d{5}(-{0,1}\\d{4})?$"); let caZipPattern = new RegExp(/([ABCEGHJKLMNPRSTVXY]\d)([ABCEGHJKLMNPRSTVWXYZ]\d){2}/i);…