<input name="number" onkeyup="if (/^[X]{1}[A-Z0-9]{3}[B]{1}[-][0-9]{6}[-][0-9]{2}$/.test(this.value)) this.value = this.value.replace(/^[X]{1}[A-Z0-9]{3}[B]{1}[-][0-9]{6}[-][0-9]{2}$/,'-')">