Regex that works for the first character entered

This commit is contained in:
benguozakinci@gmail.com 2021-07-01 12:34:58 +03:00
parent d816c00a59
commit 327d8ea94d

View File

@ -34,8 +34,10 @@ const app = new Vue({
watch: {
'form.sale_price': function (newVal, oldVal) {
if (newVal != '' && newVal.search('^(?=.*?[0-9])[0-9.,]+$') == -1) {
this.form.sale_price = oldVal;
if (newVal != '' && newVal.search('^(?=.*?[0-9])[0-9.,]+$') === -1) {
if(newVal.search('(?<!.).(?!.)') === -1){
this.form.sale_price = oldVal;
}
}
},