使用正则表达式输入银行卡号自动识别成如下格式 如下。是平安银行的卡号
623059 22222 1111 1111
下面是我写的实现的4个数的正则
<input type="text" id="Bank" onkeyup="this.value =this.value.replace(/\s/g,'').replace(/[^\d]/g,'').replace(/(\d{4})(?=\d)/g,'$1 ');" class="form-control" />
求解答
使用正则表达式输入银行卡号自动识别成如下格式 如下。是平安银行的卡号
623059 22222 1111 1111
下面是我写的实现的4个数的正则
<input type="text" id="Bank" onkeyup="this.value =this.value.replace(/\s/g,'').replace(/[^\d]/g,'').replace(/(\d{4})(?=\d)/g,'$1 ');" class="form-control" />
求解答